-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Importing plotly takes a lot of time #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm currently looking at porting a project to run on AWS lambda and the startup time of plotly is almost 90% of the startup time of the program. A benchmark of a python file which just imports plotly:
takes almost 3 seconds. The vast majority of this time (which will vary depending on your connection) is that when you import, it makes a connection to The next biggest bottleneck is Edit: Just noticed your edit. The above numbers are on |
As of version 3, importing plotly no longer performs any network connectivity, but the import time is still 1-2 seconds due to the number of code-generated files that are now present in the |
Ouch! Win10, i7, SSD.
|
Ouch! On my web server:
mean 8.6sec with 4 repeats. It is really slowing down my app. I had to put plotly import inside a function to avoid it slowing down my index page. |
@liuyigh can you give some details? Python version, plotly version, OS, etc. Running Python 3.6.7, Plotly 3.6.0 I get
|
My server is cheap f1-micro google cloud VM instance, 600MB RAM, 0.2 virtual-CPU. I ran python 2.7.15, plotly 3.5.0 on ubuntu 18.04, it can take 16-17 seconds to import plotly, average 8.6 seconds. In comparison, pandas only takes average 0.5 sec. My pyenv environment is configured under root/system as detailed by this Japanese website: Does plotly import attempt to login with retries? On my local macbook, MacOS10.14.2 Python 3.7.2 plotly 3.4.2, plotly takes 1-3 seconds to load. |
Thanks for the details @liuyigh.
No, plotly doesn't perform any network / login logic on import. I believe the import time is primarily due to the number of classes/files that are code generated into the One experiment I'd like to try at some point is to see if the import time improves if we reduce the number of files involved. Right now each Please chime in if anyone has experience with this or is interested in trying this experiment. |
I had the same issue and was digging into it. 3678aa9#diff-9d80df10529ec57d3bd692811816978d does some refactoring here. Quoting the commit message:
For what it's worth, my stats on Macbook Pro python 3.6 are: |
Thanks for sharing your timing results @AbdealiJK, glad you're seeing an improvement. Could you try timing this version as well from _plotly_future_ import remove_deprecations
import plotly This removes automatic importing of modules that will be moved/deprecated in version 4 (see #1476) and should be a little faster still. This is roughy what I expect the version 4 import time time be. @liuyigh, @MarvinGee, @gdw2 if you're still interested in this, would also appreciate your timing tests for the import above with the |
Sorry @jonmmease, I no longer have a win10 machine! |
Seems like I missed the ping.
very nice! |
Import time and initialization time should be much improved on Python 3.7 with PR #2368. |
Now that the improvements from #2368 have been released, as part of version 4.7.1, I'll go ahead and close this issue 🎉 |
Installing To resolve, you must first download the package from aptitude (see here: https://packages.ubuntu.com/focal/python3-plotly): sudo apt-get install -y python3-plotly This gets you python3-plotly version 4.4.1... Once I realized this, I was able to install that specific module version with pip: pip install plotly==4.4.1 --no-cache-dir --verbose Frequently you will find that Ubuntu stable packages are behind the latest available from source (which is clearly the case for plotly v5.5.0). The documentation should be updated to reflect this. |
Sounds like a different issue, you might be best served making a new ticket for that |
Hello,
I hope this is the right place to ask, but is it normal, that plotly takes a huge amount of time? I have two PCs both with SSDs and Anaconda installed. To the default anaconda installation I added plotly by running
On both PCs the time to import plotly is just enormous. On my desktop PC running Ubuntu 17.04 64-Bit
and on my Laptop running Windows 7 64-Bit
Is this in the normal range?
EDIT: I upgraded my plotly version from 1.12.9 to 2.0.7 and the times dropped significantly, albeit still high. Nice to see the progress being made. Now it's:
Ubuntu
Windows
The text was updated successfully, but these errors were encountered: