You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

PhoggBandit's avatar
PhoggBandit
Explorer | Level 3
4 years ago

Python error on "import dropbox"

Today I successfully installed Python 3.9.7 and the latest Pycharm version. I also installed the Dropbox API via the command:

 

  pip install dropbox

 

But my ONE-line Python program:

 

   import dropbox

 

fails with:

 

Traceback (most recent call last):
File "G:\pytest\main.py", line 2, in <module>
import dropbox
ModuleNotFoundError: No module named 'dropbox'

 

What am I doing wrong? How can I load the Dropbox APIs?

 

 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    It's possible you actually have multiple versions of Python installed, so make sure you've installed the Dropbox package in the same Python environment that you're using to run your program. (For instance, you mentioned you're using Python 3.9.7, so depending on your setup you may need to use "pip3" to install packages instead of just "pip".)

     

    Otherwise, there may be an issue with where/how your Python environment is looking for installed Python packages, such as via your PYTHONPATH setting. Refer to the Python documentation for information on configuring your environment.

    • PhoggBandit's avatar
      PhoggBandit
      Explorer | Level 3

      Greg-DB,

       

      Thanks for the prompt reply!

       

      From the Windows command prompt "import dropbox" imbedded in a test script was working fine:

       

       c:\> py test.py

       

      but was still failing even after I tried uninstalling Dropbox and reinstalling with the "pip3" command. I finally got it working from PyCharm by creating a new project and ticking the checkbox "Inherit global-site packages."

       

      * Point forward, should I also tick the checkbox "Make available to all projects"?

       

      * For an existing project, how can I enable the "Inherit global-site packages" setting? I realize I can simply create a new project and copy/paste code...

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        We can't provide support for using and configuring PyCharm, as it's not made by Dropbox. I recommend referring to the PyCharm documentation and support resources for guidance on that.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,902 PostsLatest Activity: 4 hours ago
332 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!