I've been faced to Module Not Found Error in a script which all it's requirements has been installed. I'm trying to import spatial library:
import spatial
This library is located here:
C:\Users\ASUS\AppData\Local\Programs\Python\Python37\Lib\site-packages\scipy\spatial
I checked installed packages through pip list and it was okay. I tried to install spatial-lib in Pycharm project environment but it couldn't be done:
Could not find a version that satisfies the requirement spatial-lib (from versions: )
No matching distribution found for spatial-lib
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
It's nonesence, because my pip is up-to-date. Maybe good to say, importing scipy has such probelms too.
It looks like spatial is a sub-package of scipy. Therefore, to import spatial, you should use the following:
from scipy import spatial
Related
When
import lmoments3 as lm
from lmoments3 import distr
I get module 'scipy.stats._continuous_distns' has no attribute 'frechet_r_gen'
I cded into scipy/stats folder, and there is no presence of 'frechet_r_gen'
I have tried pip install update scipy lmoments3 and pip install --user scipy
I am using conda environments.
https://docs.scipy.org/doc/scipy/release.1.6.0.html
This distribution was removed in scipy 1.6.0. So either install scipy 1.5.4 or make this lmoments3 module update to a more recent scipy version.
When I do:
import xgboost
I get no module named xgboost
I tried:
pip install xgboost
and i get:
Requirement already satisfied: xgboost in e:\anaconda\lib\site-packages (1.0.2)
Requirement already satisfied: numpy in e:\anaconda\lib\site-packages (from xgboost) (1.18.1)
Requirement already satisfied: scipy in e:\anaconda\lib\site-packages (from xgboost) (1.4.1)
versions
Python 3.7.4
pip 20.0.2 from E:\Anaconda\lib\site-packages\pip (python 3.7)
Where python:
E:\Anaconda\python.exe
C:\Users\Federico\AppData\Local\Microsoft\WindowsApps\python.exe
Usually this will happen because
You installed the package in a virtualenv and are trying to import it outside of the env
You installed the package globally and are trying to import it in a virtualenv which does not inherit the global packages
Your pip is linked to a different version than the python you're using
Based on the output of the where python it seems like you probably used the pip from anaconda to install the package, but are trying to import the package in a script that you're running with the python located here C:\Users\Federico\AppData\Local\Microsoft\WindowsApps\python.exe rather than here E:\Anaconda\python.exe
If your code with the import is in a script called test.py, for example, try running it with E:\Anaconda\python.exe test.py and see if the error still occurs
Or start a Python shell with E:\Anaconda\python.exe and then execute import xgboost in the shell and see if that works
When I want to execute my script I got the error: ModuleNotFoundError: No module named 'numpy'. But the module is already installed as said me the answer to the install command:
C:\WINDOWS\system32>pip install numpy
Requirement already satisfied: numpy in c:\users\simeo\anaconda3\envs\tensorflow1\lib\site-packages (1.17.2)
I'm quite new with Python, so I don't understand why it's not working and what could be the problem.
I'm using Windows 10 (64 bits). I installed Python 3.7
Thanks in advance!
For Windows try either two of these methods in cmd:
pip3 install numpy
pip3 install -U numpy
directly download latest version from sourceforge.net
If you are using pycharm, it can not install numpy from interpreter settings. After one of above method works, try installing numpy in pycharm again through interpreter settings.
You need to upgrade your Numpy library. Your current Keras version is not compatible with your Numpy module. You can use the below-given command to upgrade Numpy.pip install -U numpy
Try adding this to your code, above everything else:
import numpy
My goal is to build an executable using pyinstaller. The python script I am trying to build imports grpc. The following is an example that illustrates the problem called hello.py.
import grpc
if __name__ == '__main__':
print "hello world"
I do pyinstaller hello.py and that produces the expected dist directory. Then I run it like ./dist/hello/hello and I get error ImportError: No module named grpc.
So then I installed grpc using pip install grpc. When I rebuild the artifact I now get error Import grpc:No module named gevent.socket.
Reading online indicated that the correct items to install were actually grpcio and grpcio-tools. So I tried pip uninstall grpc pip install grpcio and pip install grpcio-tools. Doing this and rebuilding the artifact gave me error ImportError: No module named pkg_resources. Trying to pip install pkg_resources gives error: Could not find a version that satisfies the requirement pkg_resources
Having all grpcio grpcio-tools and grpc install gives the same error: Import grpc:No module named gevent.socket
This seems like it should be a very simple task. I simply want to use pyinstaller to build an artifact that has a dependency on grpc, how do I do this?
I faced the same issue. I referred this document: gRPC
As per the documentation, first upgrade your pip to version 9 or higher.
Then use the following commands:
$ python -m pip install grpcio
$ python -m pip install grpcio-tools
It worked for me!
I am working on doing a PyInstaller/cx_freeze distributable of a python app using grpc.
Can you try adding --hidden-import=pkg_resources and see what happens?
This solved it for me
I have installed QuTip at my CentOS 6.5.
Now I try to run this code
http://nbviewer.jupyter.org/github/jrjohansson/wavefunction/blob/master/Wavefunction-Phase-Qubit-Current-Biased.ipynb
I copy the above codes
from scipy import *
from scipy import optimize
from wavefunction import *
from wavefunction.wavefunction1d import *
....
but have some error when running
ImportError: No module named 'wavefunction'
Then I use
conda install wavefunction
pip install wavefunction
still don't work
No matching distribution found for wavefunction
Package not found
Please help me to resolve this issue about the install of the python 'wavefunction' package
Seems like he hasnt uploaded it to conda or pypi. In such cases, you can install it with git:
pip install git+https://github.com/jrjohansson/wavefunction.git#egg=wavefunction