I am working on project and getting this error
ImportError: No module named plotly.plotly
I tried:
pip install plotly
pip install --upgrade plotly
But import plotly.plotly as py didn't work.
Not sure if pyzo and python modules are stored at different location on your computer. And how they are referred.
But you can try following to give absolute path name for plotly while loading module and see if it works.
import sys
sys.path.insert(0, 'c:\\pyzo2015a\\lib\\site-packages\\plotly')
import plotly.plotly as py
I had the same exact problem, but the current answer did not resolve my issues. If that's the case, here is an alternative (IDE dependent):
I was not having success with the "pip" stuff. I am using PyCharm, and the following simple steps took care of my problems in less than 30 seconds.
Settings
Click Project: "MyProjectHere" in left hand nav menu
Select Project Interpreter from the above drop down
Find the green 'plus' sign near the upper right edge of the window
that comes up.
Type Plotly in the search bar
Click install.
Maybe one day I won't be a dumb monkey who doesn't know how to use a command line like all the cool kids, but for now this worked for me.
I had the same problem installing plotly with pip and then import not being able to find it, but it worked when I used conda, instead.
Related
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.
I'm getting ModuleNotFoundError: No module named 'macrobond_api_constants'although the package seems to be installed correctly. I checked using conda list command.
https://pypi.org/project/macrobond-api-constants/
The instruction says this should be imported using import macrobond_api_constants
I tried to import using both Spyder and PyCharm. Any idea how to fix this?
In pycharm import libraries exist in different way. You can try this
1. Open PyCharm.
2. go to File -> settings -> Project:test(test means your project name) -> select project interpretor -> click add button
3. after clicking add button and search the library which you want to install then install it.
finally run the program.
Thank you everyone that wanted to help me with this issue. I contacted lib authors (Macrobond) saying I cannot access library and turns out there was something that they messed. An update has been just released couple days ago. Library is now accessible and works pretty well.
I'm using PyCharm and learning the basics of Machine Learning through a Mooc.
As always, things don't go as expected when you try things shown by the teacher by yourself and until now I was able to fix the issues by myself but I'm stuck since quite a while and that's why I created an account here :)
when I try import sklearn as pd (can't find how to do this as "code") I get ModuleNotFoundError: No module named 'sklearn'
I've had the same issue with pandas and numpy previously and was able to solve it by adding
import sys
sys.path.append("numpy_path/pandas_path")
and trying some things on the terminal (I'm on Mac) like pip install numpy or conda install numpy but this time nothing seems to work.
I suspect the issue to be that sklearn is somewhere else on my computer than where the Python program is searching but am not sure.. Let me know if you can help :)
It may be that Pycharm is using a different interpreter environment than you were using before. Best way to check is in Pycharm go to Pycharm on the menu, then preferences, then under 'Project' choose 'Project Interpreter'. At the top a dropdown will show you what environment Pycharm is using for this project. Underneath will be all the libraries you have installed in that environment. You can look down the list and check if the libraries you want are installed. If they aren't hit the + button underneath, search for the libraries, select and hit install.
Also a note. It's odd that you are choosing to import sklearn as pd as that is not the convention. The convention is to import pandas as pd. Technically it is not incorrect, the interpreter will accept it, but it is not the convention.
I am having a bit of trouble getting my plotly imports to work. I am a new Python programmer.
I followed the following instructions to a 'T':
https://plot.ly/python/getting-started/
When I copied the demo code into pycharm, I got errors on the imports. So I found a guy who had the same question as me here:
Import error : No module named plotly.plotly
Following prompts in the comments, I used "pip show plotly" in my command line, and copied and pasted the path, and reformatted the import like so (again as prompted by comments and the accepted answer:
import sys
sys.path.insert(0, 'c:\users\wesle\appdata\local\programs\python\python36-32\lib\site-packages')
import plotly.plotly as py
Still getting the same red squigglies...
Is plotly the right library to be using for a beginner? I will be using it to plot the results of numerical methods like calculating function values using taylor series and linear algebra stuff. I don't need super fancy, just whatever is easiest to code. By the way, really digging Python coming from Java.
So, I'm not a command line expert and decided to look within my IDE for a tool to set up plotly, as I was not having success with the "pip" stuff. I am using PyCharm, and the following simple steps took care of my problems in less than 30 seconds.
Settings
Click Project: "MyProjectHere" in left hand nav menu
Select Project Interpreter from the above drop down
Find the green 'plus' sign near the upper right edge of the window
that comes up.
Type Plotly in the search bar
Click install.
Maybe one day I won't be a dumb monkey who doesn't know how to use a command line like all the cool kids, but for now this worked for me.
If you are using Anaconda Python for notebook, you have to manually install plotly in anaconda:
Open Anaconda navigator
Go to Environments
Change installed to not installed
Search packages field and type plotly as uninstalled
Select it and click apply
After it gets installed you'll be able to import the package in notebook.
I just installed the textblob package in python. All works fine. However when I enter:
from textblob import TextBlob as tb
My pycharm editor still gives an importerror:
ImportError: No module named textblob
But in cmd screen I have:
"Succesfully installed TextBlob ..."
Any thoughts on what could go wrong here?
It seems it is not installed in your env. In Pycharm, Take the cursor to package name use alt+enter.it will give a message to install the package. Install the package (it will take some time as it will download from internet) Also it will index the whole package.
It might also happen that you are not configured project interpreter properly. Go to File menu 'Default Setting' Look in left side bar for project interpreter check in right side if its there. If yes, it will show the package installed here.