Install Plotly in Anaconda

自闭症网瘾萝莉.ら 提交于 2019-12-06 18:48:50

问题


How to install Plotly in Anaconda?

The https://conda.anaconda.org/plotly says to conda install -c https://conda.anaconda.org/plotly <package>, and

The https://plot.ly/python/user-guide/ says to pip install plotly. I.e., without package.

So which packages I should specify in Anaconda conda?

I tried without one and get errors:

C:\>conda install -c https://conda.anaconda.org/plotly
Error: too few arguments, must supply command line package specs or --file

回答1:


If you don't care which version of Plotly you install, just use pip.

pip install plotly is an easy way to install the latest stable package for Plotly from PyPi.

pip is a useful package and dependency management tool, which makes these things easy, but it should be noted that Anaconda's conda tool will do the same thing.

pip will install to your Anaconda install location by default.

Check out this description of package and environment management between pip and conda.

Edit: The link will show that conda can handle everything pip can and more, but if you're not trying to specify the version of the package you need to install, pip can be much more concise.




回答2:


Clearing things up

@xpt, you have some confusion here:

  • Conda is used to install packages (plotly is a package, numpy is a package, cufflinks is a package etc.)
  • The list of available packages is found in some index, which in Conda parlance is called a channel. The default, "official" channel is maintained by Anaconda (Conda's developer), but anyone can open his own channel, and use it to distribute custom packages.

So, in the command you've shown: conda install -c https://conda.anaconda.org/plotly <package>

  • The -c switch tells Conda to use a custom channel which happens to be called https://conda.anaconda.org/plotly1
  • <package> is the package to download from that channel.
  • Specifying a channel is optional, and if you don't - then Conda will look in its default channels. But you must specify a package so that Conda knows what to install.

1 This is in fact a channel that belongs to a user called plotly, which is hosted on Anaconda Cloud, a free service offered by Anaconda to host custom channels.

Back to your question

This channel seems to be unmaintained (the plotly package hosted there is very old). Given that, and the fact that the official plotly documentation says to use pip, that is what I would use.

Update: plotly updated their conda build, and added conda as an installation option in their GitHub repo (albeit not in their documentation website). So you can now safely use:

conda install -c https://conda.anaconda.org/plotly plotly

or even simpler (since Anaconda Cloud channels are searched automatically):

conda install -c plotly plotly

When using Anaconda Python, conda is the preferred way to install packages, but in any case both conda and pip should be run under Anaconda Prompt on Windows (Start --> Anaconda --> Anaconda Prompt). Installing packages from the standard command prompt when you have Anaconda is discouraged and can mess up your Anaconda installation.




回答3:


Using Anaconda, the following worked for me:

To search for which plotly packages are available on anaconda: anaconda search -t conda plotly This will provide a list of user/package for plotly available.

Decide which user/package works for your operating system and which version of Plotly you want. Then to get more information about that type in: anaconda show [user]/[package]. Installation instruction should be provided near the end. Typically, this is: conda install --channel https://conda.anaconda.org/[user] [package] where you should replace [user] and [package] with the user/package of your preference.




回答4:


To install plotly in windows on anaconda. Go to anaconda prompt, write in this code :

conda install -c plotly plotly 

It will automatically update the modules and the rest should take care of itself. I also did not find the need to close and refresh spyder and the graphs started working on mine




回答5:


Suppose you have Anaconda installed than 'pip' might not work, in that case use:

conda install -c https://conda.anaconda.org/plotly plotly



来源:https://stackoverflow.com/questions/34072117/install-plotly-in-anaconda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!