I tried to create a new environment in Anaconda, if I launch jupyter using this new environment, it will report error on the statement "import pandas as pd"
import pandas as pd
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-7dd3504c366f> in <module>()
----> 1 import pandas as pd
ModuleNotFoundError: No module named 'pandas'
When I goto "environment" menu, check the installed module for this newly created environment, I do find that pandas 0.20.3 has been marked as "installed" . It's weird that if I switch to the root environment (the default environment after installing Anaconda), I'm able to import pandas without any error. Wondering why it doesn't work for the new environment?
Thanks a lot in advance.
This happened to me as well, the fix was simple - there is something wrong with the search box in Anaconda's navigator so searching for "pandas" will return no results
Instead, at the top, select "not installed" in the dropdown, then scroll down to pandas in the list instead of searching. Then click the checkbox to enable.
Related
I get the error in the title when I try to import matplotlib. Please I have been searching for 3 hours and still no solution.I've tried source activate base changing the interpreter, I have updated to latest matplotlib. and I have tried echo "backend : TkAgg" > ~/.matplotlib/matplotlibrc but none of these works. But numpy works but for some reason matplotlib does not. any help is appreciated.
terminal message:
Traceback (most recent call last):
File "/Users/MacBook/python/code/stats.py", line 2, in <module>
import matplotlib
ModuleNotFoundError: No module named 'matplotlib'
(base) MacBook-Air:~ MacBook$
My matplotlib version:
On another note: when trying to import matplotlib I see a matplotlib_inline but not matplotlib on VS CODE
Since You already installed matplotlib and since I had a similar problem, heres what I did:
1.) change your python interpreter: In VSCODE there's usually a "recommended" interpreter that they will recommend, try that one. If that dosen't work try to use the interpreter with "conda" in the name.
2.) This is the most important but overlooked step: RESTART your VS code to see the changes. bring up the command palate via cmd + shift + p, then type in "reload" and a "reload window" should pop up, click on it to reload.
3.) once reloaded you should be able to import matplotlib now.
Restarting vsCode after a library installation is underrated. it solved my problem with accesssing urllib3 after an installation
I am using Github Desktop to access a group Github repo, while running the code below on a ipynb file in VS Code. When I run the following code, I am unable to import pandas even though I have it installed. When I comment out pandas, I am unable to import numpy, even though I have had that installed as well. And so on...
Any reason as to why this may be the case? Thank you.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-01bc08e5df4c> in <module>
1 # Dependences
----> 2 import pandas as pd
3 import numpy as np
4 import matplotlib.pyplot as plt
5
ModuleNotFoundError: No module named 'pandas'
Check if modules were installed in Jupyter current used environment.
After selecting python interpreter, open a new integrated Terminal and run pip show pandas, then see if the module is in folder lib/site-packages under the current environment. If not, please reinstall them.
Reference: Using Python Environment in VS Code.
I'm kind a new Python user - using Anaconda Python and VS code. I'm trying to launch my jupyter notebook, but I'm not able to import geopandas.
import geopandas
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import geopandas
ModuleNotFoundError: No module named 'geopandas'
I can see geopandas in 'conda list' in myenv, but still if I want to check it in my jupyter notebook I get negative response
import sys
'geopandas' in sys.modules
False
enter image description here
I already tried a lots of advices from here and git hub, but I'm not able to figure it out.
Am I missing something?
Thanks a lot for help!
Did you install the geopandas library before? If you don't do this before Please open your anaconda prompt form start menu and command the below lines
conda install -c conda-forge geopandas
and then press the enter button.
After that, You may apply below the line on your code
Update Code:
from geopy import geocoders # For matching the buildings' cities with time zones
from geopy.exc import GeocoderTimedOut # Catch timeouts while using Google geocoding API
from geopy.exc import GeocoderUnavailable # Catch other network problems
As long as you are sure that you can access the environment on jupyter,
What you have to do is to to manually install the packages.
Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/, to download the compatible version for GDAL, Pyproj, Fiona, Shapely and Geopandas.
Then manually installed each using:
pip install the_file_path_to_the_downloaded_file
I hope this helps!
I ran into a similar problem with visual studio code. For me there is a button in the upper right corner of the VS Code window with the current environment selected. I clicked it and it allows me to change the kernel for the notebook :
This is assuming you have the dependencies installed.
First of all, I want to note that I've read a lot of links related to my problem.
I have some problems with running the code when I want to import a module.
Here is an example of the code:
import numpy as np
Then PyCharm gives me an exception:
Traceback (most recent call last):
File "/Users/Alexander 1
2/PycharmProjects/Coursera/Week1/Vectors/Vecors.py", line 1, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'
Process finished with exit code 1
I have read this and did all what was written. However, it hasn't been working. I've reloaded the PyCharm – no result.
Help me, please! I'm using MacOS 10.13.5, PyCharm 2018.1.4 CE.
You probably have created a new project using virtualenv, read about it here.
It basically creates a new project specific environment, so the libraries inside won't cause a conflict with python2 and python3 packages. So, inside Pycharm, open terminal by pressing alt+f12 , which will open a terminal inside Pycharm, and install numpy usually by pip install numpy
I don't know why, but when I rebooted the computer and created a new project, this problem has disappeared.
I have the newest Anaconda 2.3 on a non-network-Linux-machine. Everything works fine besides
import sklearn
I then get back
----> 1 import sklearn
sklearn.py in <module>()
ValueError: Attempted relative import in non-package
I have to go into the /pkgs folder in anaconda and into scikit-learn to import from there. This works and whats even weirder, when I type
import
and the tabulator to show possible packages, sklearn is shown.
Might be that you're using another Python installation on your computer.
For instance, I have Python in my Anaconda environement and the other one by default. If execute: ~/anaconda/bin/python I can import sklearn without problems.
On the contrary if I execute /usr/bin/python and then try to export it I get the error message since I installed sklearn from Anaconda.
Check your PATH variable with typing $PATH on your terminal and check the order, if Anaconda is not the first one (or it's not there) type: export PATH="/path/to/anaconda/bin:$PATH"
I hope this works.