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.
Related
I have several imports in my current code:
from flask import Flask
import datetime as dt
import numpy as np
import pandas as pd
When I run this in VSCODE I am getting this error:
However, running this in jupyter notebook has no problems. When I looked online it said to use python interpreter but when I go to do that I get this error:
And another error:
Anaconda prompt says modules/packages are installed but when I run pip install in default windows terminal it says pip has no module:
Delete and reinstall Python extensions according to the same problem on github.
The second problem is related to the location of your Python interpreter. You need to choose the correct interpreter. I still recommend using one Python version in one environment. You can use other Python versions in virtual environment, so it won't lead to confusion.
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 just got Jupyter running in python 3 on Google Cloud but I have a lot of trouble getting the libraries installed while working on a tutorial online. How exactly am I supposed to install libraries on the cloud Vm?(Numpy, mathplotlib) I tried using !pip install numpy and even the jupyter terminal to install libraries but noting seems to work. I even tried installing before I got the server running in the SSH because after it starts I dont have any control to do anything beside exit the server. I really need some python libraires can anyone help?
ImportError Traceback (most recent call last)
<ipython-input-7-cdbc221dd3db> in <module>()
1 import numpy as np
----> 2 import matplotlib.pyplot as plt
3 from sklearn.datasets import load_digits
4 digits=load_digits()
5 import pylab as pl
ImportError: No module named matplotlib.pyplot
You can install dependencies on your Jupyter Notebooks by following this doc.
You can choose one of these options:
Run %pip install LIBRARY in a Notebook's cell and restart the AI Platform Notebook's Kernel. Doing this will allow you to the import and use the "LIBRARY" in your code.
Run pip install LIBRARY from a Jupyter Notebook's terminal. This way is the most similar as installing the libraries on your local computer.
In the provided doc, you will find how to reach the terminal or how to restart your AI Platrofm Notebook's kernel.
Hope this is helpful! :)
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.