Pycharm Requirement already satisfied but not add lib - python

When I was running pip install numpy it says Requirement already satisfied.
However, env\lib\site-packages doesn't seem to have lib numpy. As a result, when I ran project I was getting ModuleNotFoundError: No module named 'numpy'. How should I resolve this issue?

Related

ModuleNotFoundError: No module named 'bs4' [sublime text 3]

Basically I am trying to run some simple code in sublime text 3 but when I try to run it it gives me the following error:
File "/Users/ingodavila/Desktop/My Programming/scrape.py", line 1, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
I have tried installing it with pip3 and easy_install but it does not work. Whenever I try installing it it in terminal it keeps showing:
Requirement already satisfied: bs4 in ./opt/anaconda3/lib/python3.8/site-packages (0.0.1)
Requirement already satisfied: beautifulsoup4 in ./opt/anaconda3/lib/python3.8/site-packages (from bs4) (4.9.1)
Requirement already satisfied: soupsieve>1.2 in ./opt/anaconda3/lib/python3.8/site-packages (from beautifulsoup4->bs4)
I tried running it in a jupyter notebook and it works but for sublime it keeps showing that 'nomodulefound' error. What can I do to solve this?
Are you running the code inside a virtual environment?
If you are, try this method:
activate the env
install the module (inside the virtualenv)
run the code.
If the above doesn't work, try:
conda install bs4
It is probably because your Sublime text interpreter is different than your global one. I would recommend you using virtual environment instead of just installing modules globally. Check this one out on how to create venv. Once you set up your virtualenv and active it, you can just install packages and use them without any problem.

ImportError: No module named yaml - but I have yaml

The logical answer, if I don't have a specific module is to just install it. pip install pyyaml but I have installed it, and this just spits back "Requirement already satisfied: pyyaml in /usr/lib/python3.8/site-packages (5.3.1)".
I got this issue while setting up Baxter for Gazebo.
PLUS INFO: I can import it for any other project, except this.

ImportError: No module named xgboost and package already installed

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

ModuleNotFoundError: No module named 'spatial'

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

No module named 'xlrd' when xlrd module is installed

I am using Jupyter Notebook in an environment, and when I try to use xlrd module I get "No module named 'xlrd". I checked others Stack Overflow posts and I installed the module xlrd using the command pip3 install xlrd. but still it continues to throw me the error No module named 'xlrd.
I tried again to install may be something went wrong and I get Requirement already satisfied: xlrd in /usr/local/lib/python3.6/site-packages which I believe it's ok. Is it possible that I have to update my environment in order to use the new installs? If so how do I do it?

Categories