Search code examples
pythonmodulepipanacondagspread

Install module mac os Catalina Anaconda


Set-up

I've been so stupid to update to Mac OS Catalina, rendering my installation of Anaconda useless. On top of that; I don't have a back-up, so I can't simply downgrade back to Mojave without losing all my stuff.

That said, I've reinstalled Anaconda following reinstallation method 1 of Anaconda's blog post on the Catalina issue. Lo-and-behold, Anaconda and Spyder 3.3.6 are working again, allowing me to work with Python 3.7.

Sadly, all my modules seem to be gone, e.g. import gspread gives ModuleNotFoundError: No module named 'gspread'.


Tries

I've reinstalled gspread using pip3, e.g. pip3 install gspread. This gives,

Requirement already satisfied: gspread in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (3.1.0)
Requirement already satisfied: requests>=2.2.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from gspread) (2.22.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.2.1->gspread) (1.25.6)
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>=2.2.1->gspread) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.2.1->gspread) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.2.1->gspread) (2019.9.11)

but I keep getting ModuleNotFoundError: No module named 'gspread'.

I'm using gspread as an example, but so far all installed modules have given the same error.


Issue(s)

As you can see above, gspread is installed in version Python.framework/Versions/3.6, but Spyder is running Python 3.7. I'm not sure but I can imagine this could be the issue. I don't know though how to either install gspread for version 3.7 or how to get Spyder to run python 3.6.

And of course, if this is actually not the issue, I'm not sure what else is up.

Anyone any ideas?


Solution

  • Note how the requirement already satisfied messages all point to

    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
    

    which does not look like it would be your anaconda installation. So your pip3 is actually not pointing to your anaconda installed python 3.7 version. Your spyder however seems to be configured to use the anaconda distribution.

    It might be easily fixed if you activate your base environment using

    conda activate
    

    this should modify the environent variables so that python and pip calls will go to the anaconda version.