I’m working with a user who has installed cartopy in her Anaconda environment (base/root), but it has not been installed in her Spyder environment where she’s trying to run a script requiring cartopy. Does anyone know the proper way to import/install the module in Spyder? Or do we need to activate the base/root environment for Spyder? Thank you!
Hi @macy.morgan and welcome!
There are two ways you can use Spyder within conda:
- Either you install it in each one of the environments that you’re using, and where it makes sense to have it
- Or you can install Spyder in its own environment and connect it to another environment (the base environment) with a procedure that is described in details in Spyder’s Wiki.
And here’s a few general pieces of advice:
- Don’t hesitate creating new environments, it’s easy to do and prove very useful in a lot of situations. Your user could just run from the command line
conda create -n herenvname spyder cartopyto create a new environment, then activate it withconda activate herenvnameand run Spyder withspyder. - It’s best to avoid installing packages in the
baseenvironment. The cleaner this environment is, the easier it is to update conda itself and the less likely it is to break things. - Installing new packages in an existing environment can in some cases be challenging for conda if there are already a lot of packages installed in this environment. Again, in that case, don’t hesitate creating a new environment (and removing the older one if it’s of no use).