Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

plotly_express installs via pip but doesnot import #11

Closed
nitin0301 opened this issue Mar 20, 2019 · 13 comments
Closed

plotly_express installs via pip but doesnot import #11

nitin0301 opened this issue Mar 20, 2019 · 13 comments

Comments

@nitin0301
Copy link

Hi,

I am using Python 3.6.8 in anaconda environment.

pip install plotly_express works.:

(py3) bash-3.2$ pip install plotly_express
Requirement already satisfied: plotly_express in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (0.1)
Requirement already satisfied: plotly>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly_express) (3.7.1)
Requirement already satisfied: scipy>=0.14 in ./Library/Python/3.6/lib/python/site-packages (from plotly_express) (1.1.0)
Requirement already satisfied: pandas>=0.20.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly_express) (0.21.0)
Requirement already satisfied: statsmodels>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly_express) (0.9.0)
Requirement already satisfied: retrying>=1.3.3 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (1.3.3)
Requirement already satisfied: pytz in ./Library/Python/3.6/lib/python/site-packages (from plotly>=3.6.0->plotly_express) (2018.5)
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (1.11.0)
Requirement already satisfied: nbformat>=4.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (4.4.0)
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (2.21.0)
Requirement already satisfied: decorator>=4.0.6 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (4.4.0)
Requirement already satisfied: numpy>=1.8.2 in ./Library/Python/3.6/lib/python/site-packages (from scipy>=0.14->plotly_express) (1.15.0)
Requirement already satisfied: python-dateutil>=2 in ./Library/Python/3.6/lib/python/site-packages (from pandas>=0.20.0->plotly_express) (2.7.3)
Requirement already satisfied: patsy in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from statsmodels>=0.9.0->plotly_express) (0.5.1)
Requirement already satisfied: traitlets>=4.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (4.3.2)
Requirement already satisfied: jupyter-core in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (4.4.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (3.0.1)
Requirement already satisfied: ipython-genutils in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (0.2.0)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (2018.8.13)
Requirement already satisfied: idna<2.9,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (3.0.4)
Requirement already satisfied: setuptools in ./Library/Python/3.6/lib/python/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=3.6.0->plotly_express) (40.0.0)
Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=3.6.0->plotly_express) (19.1.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=3.6.0->plotly_express) (0.14.11)

BUT I cannot find the module when I do "import plotly_express":

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import plotly_express

ModuleNotFoundError: No module named 'plotly_express'

@nicolaskruchten
Copy link
Contributor

That's quite strange... Can you tell me a bit about your environment? Which version of Python and pip are you on?

@nitin0301
Copy link
Author

Python 3.6.8 & pip 19.0.3

@nicolaskruchten
Copy link
Contributor

Thanks, and sorry I missed the Python version you'd already provided at the top there... I'm not sure if it will fix your issue but I've just pushed up version 0.1.1 of plotly_express which requires plotly>=3.7.1 only (and not alongside plotly>=3.6.0). Perhaps installing will work in your environment now?

@nitin0301
Copy link
Author

Thanks nicolaskruchten. It is working on my pycharm but not in conda. So, this will work for now.

@CloudChaoszero
Copy link

CloudChaoszero commented Mar 22, 2019

Hey, hope you are doing well @nitin0301.

Similar Scenario

I had the same issue as you. I went through to try to resolve it, but I actually found a quick workaround for this issue, while a somewhat larger issue is at hand for particular pip paths for some people.

Workaround

Run this line in a cell within your Jupyter Notebook:

!pip install plotly_express

Root Cause

When we ran pip install plotly_express in our CLIs, we downloaded the package in the system's pip tool, and not within anaconda's pip. Even with the consideration of creating an environment, you would get this issue.

After some trial and errors from finding out that upgrading jupyter, system's python, and manually trying to change the .bash_profile's filepath, I got nothing.

Why Though

Solution

After checking the diff's of the system and jupyterpip list and conda list, I thought:
"why don't I just run the command within the Jupyter Notebook?"

!pip install plotly_express

Ran the following, and it seems to work now.

#Example code from documentation
iris = px.data.iris()
px.scatter(iris, x="sepal_width", y="sepal_length")
#Enjoy the visualization, hopefully :D 

Note: Your Pycharm has an association with system's default pip and python, but not to anaconda's equivalent

Work still needed

Direct the pip and python path's from system/CLI to anaconda's paths.

@nicolaskruchten thoughts?

@khalido
Copy link

khalido commented Mar 26, 2019

I am using Python 3.6.8 in anaconda environment.

when you make a new conda env, install pip in it first, otherwise when you pip install something inside the conda env it uses the base anaconda pip file.

Its quite confusing, anaconda should just install pip by default inside environments.

@matanox
Copy link

matanox commented Sep 18, 2019

Same error with conda 4.7.12, even in a simple python prompt after conda install -c plotly plotly_express had successfully completed:

ModuleNotFoundError: No module named 'plotly.express'

Looks like we need to specify the plotly express version in order to avoid this:

conda install -c plotly plotly_express==0.4.0

@myounus96
Copy link

simply upgrade the plotply

@entzyeung
Copy link

!pip install plotly_express

will fix this problem

@yesikapsari
Copy link

!pip install plotly_express

thank you

@mqsaud
Copy link

mqsaud commented Jan 20, 2022

!pip install plotly_express did not fix for vs code

@SomKamoji
Copy link

same like mqsaud it did not fix for me

@Wrench-wench
Copy link

!pip install plotly_express did not fix for vs code

I had the same issue in VS Code on Windows 10, what fixed it for me was I was using Python3.9 installed from the Windows Store. Switching to Python installed by the Python installer solved the import issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests