2

New to python. Not sure how to to add a module.

import plotly.express as px

Error:

ipdb> ModuleNotFoundError: No module named 'plotly'

What steps are need to have this module recognised?

Akshat Zala
  • 710
  • 1
  • 8
  • 23
EProg88
  • 21
  • 2

1 Answers1

0

What worked for me, both under Windows and under MacOSX, is using Anaconda for all Python apps. This post also advises to use Anaconda:
Python dependency hell: A compromise between virtualenv and global dependencies?

I also found this article to be useful:
https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-spyder

These are the steps I took.

  • Install Anaconda:
    https://docs.anaconda.com/anaconda/user-guide/getting-started/

  • Under Windows, open the Anaconda cmd prompt from the Anaconda Navigator. Under MacOSX, just open the cmd prompt.

  • In the cmd prompt, install plotly with this command:

      conda install plotly
    

    This installs plotly in the Anaconda environment.

  • Launch Spyder from the Anaconda Navigator. Always launch Spyder from the Anaconda Navigator, to make sure you're running the copy of Spyder from the Anaconda environment.

  • In a Python script, load plotly:

      import plotly as py
    

After that you should be good to go with plotly.

algoquant
  • 1,087
  • 1
  • 11
  • 15