hayeon
hayeon

Reputation: 51

ModuleNotFoundError: No module named 'scipy.special._ufuncs'

I already installed scipy on Python3.6:

sudo apt-get install python3-scipy
pip3 install scipy

But, it does not work with this error.:

ModuleNotFoundError: No module named 'scipy.special._ufuncs'

How can I do?

Thanks very much for your help.

Upvotes: 2

Views: 6512

Answers (2)

ev-br
ev-br

Reputation: 26110

In general, don't use sudo pip. Best use a virtualenv, and install everything into it. What you see is a sign of a broken install, best reinstall from scratch --- or activate a virtualenv.

Upvotes: 0

thepoetdj
thepoetdj

Reputation: 773

The ufuncs (aka Universal Functions) is part of the NumPy framework. When working with SciPy, it is necessary to install NumPy first as it's a dependency. You are getting this ModuleNotFoundError is likely due to the unavailability of NumPy package.

Before you try anything, list the currently installed packages:

pip3 list

If NumPy isn't installed then try installing it:

pip3 install numpy

Edit:

It seems that you had tried install scipy using ubuntu package installer. That's why your scipy version is 0.17. Sometimes it is possible that some ubuntu packages are outdated. Therefore, it's better to use the official package managers, like PyPI in case of Python.

First uninstall the scipy installed by the package manager:

sudo apt-get purge python3-scipy

When uninstalled successfully, reinstall it using PyPI:

pip3 install scipy

This will install the latest version (1.1.0) from python package index.

If all goes well, you should be able to run your code without any errors.

Upvotes: 1

Related Questions