ImportError: No module named yaml - but I have yaml - python

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.

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 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

Pycharm Requirement already satisfied but not add lib

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?

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?

No module named openpyxl - Python 3.6 - OSX

I've installed openpyxl from the Terminal using
pip3 install openpyxl
without any problems. I've even double-checked by simply running import openpyxl from the Terminal window once Python is running, and it imports no problem.
The problem starts when I try and import openpyxl from a script I'm building to work with a spreadsheet. I'm using Sublime Text and can't even get past the import openpyxl at the beginning of the script without running into the following error:
Traceback (most recent call last):
File "/Users/wcw/Desktop/test.py", line 1, in
import openpyxl
ImportError: No module named openpyxl
How can this be happening? I know I've installed openpyxl correctly from the Terminal window without any errors so how can my script not find the module?
Try to do:
pip3 install --user openpyxl
Doing the --user worked for me when I tried to run my .py files with matplot lib modules which worked in 3.5 but not in 3.6.
I have the same problem.
I've installed the openpyxl succesfully via Anaconda
!pip3 install --upgrade openpyxl
Collecting openpyxl Using cached
https://files.pythonhosted.org/packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz
Requirement already satisfied, skipping upgrade: jdcal in
/Users/a18301335/Library/Python/3.8/lib/python/site-packages (from
openpyxl) (1.4.1) Requirement already satisfied, skipping upgrade:
et_xmlfile in
/Users/a18301335/Library/Python/3.8/lib/python/site-packages (from
openpyxl) (1.0.1) Installing collected packages: openpyxl Found
existing installation: openpyxl 1.8.6
Uninstalling openpyxl-1.8.6:
Successfully uninstalled openpyxl-1.8.6 Running setup.py install for openpyxl ... done Successfully installed openpyxl-3.0.3
But when I try to use tat library I get an error No module named openpyxl
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
If I try to import openpyxl in Terminal, I don't have the error. What's wrong?
This may be overly simplistic, but I had the same problem. I installed the module successfully but import openpyxl resulted in an error. I needed to close IDLE and start a new session. After that, my import command worked just fine.

Categories