When spyder starts up, and there is a new version available, it says to run conda update anaconda before updating spyder itself. But this gives me a PackageNotInstalledError.
After looking through my file directory, I see an anaconda in /home/anaconda3/bin.
When I conda update --prefix /home/erik/anaconda3/bin anaconda I get DirectoryNotACondaEnvironmentError.
When I conda update --prefix /home/anaconda3 anaconda I get EnvironmentLocationNotFound: Not a conda environment: /home/anaconda3.
I have a few virtual environments, plus the base environment. conda list from the base environment shows anaconda-client and anaconda-navigator, but no plain anaconda or anaconda3. conda update --all works fine. conda update *any other installed package* works fine too. Is the message in the spyder pop-up just misleading then?
The error message āDirectoryNotACondaEnvrionmentErrorā is correct in this case.
The directory ā/home/erik/anaconda3/binā is just where the ananconda executable lives.
You can type the command:
conda env list
to list all available conda environments.
The conda environments themselves will be located in the directory ā/home/anaconda3/envsā on your system.
i have the same problem. From the base environment I did conda update conda sucessfully, but conda update anaconda gives an error. Is there a solution?
(base) C:\Users\jdcar>conda update anaconda
PackageNotInstalledError: Package is not installed in prefix.
prefix: C:\Users\jdcar\anaconda3
package name: anaconda
Is the anaconda metapackage installed into the environment where you are attempting to update it? In other words, if you use the conda list command, is anaconda one of the packages listed under the Name column?
What happens when you try conda install anaconda
The output of conda install anaconda follows below:
(base) C:\Users\Oleg>conda install anaconda
Channels:
- defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\Oleg\anaconda3
added / updated specs:
- anaconda
The following packages will be downloaded:
package | build
---------------------------|-----------------
anaconda-2024.02 | py311_mkl_1 76 KB
ca-certificates-2023.12.12 | haa95532_0 127 KB
openssl-3.0.13 | h2bbff1b_0 7.4 MB
------------------------------------------------------------
Total: 7.6 MB
The following NEW packages will be INSTALLED:
anaconda pkgs/main/win-64::anaconda-2024.02-py311_mkl_1
The following packages will be DOWNGRADED:
ca-certificates 2024.3.11-haa95532_0 --> 2023.12.12-haa95532_0
openssl 3.0.13-h2bbff1b_1 --> 3.0.13-h2bbff1b_0
Proceed ([y]/n)?
It looks a bit strange that installation of anaconda wants to downgrade 2 important packages which there updated recently by running conda update conda.
The anaconda metapackage pins the versions to each installer release. Looks like you have a few packages that are newer than when the last release came out in February of this year. In other words, this is working as expected. If the anaconda metapackage isnāt installed, you will get that message you highlighted originally when you attempt to update it - that is also working as expected.
What was your goal with running conda update anaconda? To update the packages in your environment to the latest?
Excluding the anaconda metapackage itself from the Anaconda Distribution installer was an intentional change that happened in Feb 2023. In general, it is best practice to have your working environment not be your base environment - so Iād recommend creating a new environment with the anaconda metapackage installed.
Alternatively, you could try using conda update --all to update the packages in your current environment - but I would recommend not doing this in your base environment, because if something ever goes wrong with the base installation, it means you need to reinstall everything.
So the observed absence of anaconda metapackage in the base environment is an expected change in behavior which occurred more than a year ago. Thanks for getting this clear, that was mine main concern.
At this point I got somewhat confused, let me share my thoughts with you.
I use base environment. Running conda update conda I can update it.
Running conda update anaconda I get an error about anaconda metapackahe was not installed. That make sense now as the metapackage was not installed by default since Feb 2023. Same time Updating conda and Anaconda ā Anaconda documentation still suggest:
To update to the latest version of Anaconda, enter these commands:
conda update -n base conda
conda update -n base anaconda
e.g. the presence of installed metapackage anaconda in base environment is explicitly expected. I feel I am missing somethin at this point: the documentation suggests one thing, but the reality is quite different.
If I try to install anaconda metapackage in base environment I get offered to:
Install metapackage anaconda
Downgrade ca-certificates package (it was recently upgraded with conda update conda)
Downgrade openssl package (it was recently upgraded with conda update conda too).
At this point I assume that installation of anaconda metapackage do not add anything to base environment, but tries to downgrade 2 packages which conda package has recently updated. So I begun to question what for anaconda metapackage is if it do not add anything to base environment? And why anaconda metapackage tries to downgrade packages upgraded by conda package? It looks like some desynchronization between these 2 packages. So far I see no any need to install anaconda metapackage as it do not add new packages to base environment.
Yes - I see your concerns and confusion. We should update that documentation page to reflect the current recommendations. Thank you for highlighting that.
At the current moment, there is probably not a huge advantage for you to have the anaconda metapackage installed as you have a pretty recent installation of the Anaconda Distribution. After the next release, with it, you can use it to easily update all the anaconda packages to the version shipped in the next installer - without having to download a new installer, etc. The specific versions of the anaconda metapackage have the packages pinned to the versions included in the installer. In other words, version 2024.02 of the anaconda metapackage has the versions of the packages pinned to the specific versions included in the installer released in February of this year.
If you have the ācustomā version of the anaconda metapackage installed, it should allow you to get the latest version of all the packages in the metapackage.
In other words, above, I should have asked what happens when you try conda install anaconda=custom
So as time goes on, it will be more useful - as it will allow many updates at once, instead of having to update each package individually. The team is regularly adding new package updates to the repo.anaconda.com.
Thanks for the support thus far. I have arrived at exactly the same situation as Oleg with my fresh install, and this happened for the same reason as it did for Hans originally - trying to update Spyder. I understand what you have explained but have several questions that follow on.
[1]
Based on the Spyder instructions, I had attempted to first update Anaconda via:
(base) > conda update conda
(base) > conda update anaconda
And as discussed above, only the first command worked which updated two packages: ca-certificates and openssl. I guess you would recommend downgrading those two packages in my base environment back to the pinned versions of the Anaconda release.
Question: Iām guessing to do this, I should run:
(base) > conda install anaconda
When I do that it suggests it will not only downgrade ca-certificates and openssl, but also install NEW anaconda 2024.02-py311_mkl_1. I guess this is ok, as it is telling us that Anaconda will be installed but that nothing will actually happen except two packages will be downgraded. And as I can confirm the operation completes in a few seconds.
[2]
When a new Anaconda release becomes available, given that the old instructions are no longer correct (update conda, update anaconda)ā¦
Question: what should I do to update my base environment? Perhaps it is just as above?
(base) > conda install anaconda
[3]
The current Anaconda release includes Spyder 5.4.3. Lets say I create a new environment myenv using the current Anaconda release, and then update Spyder there:
(base) > conda create --name myenv --clone base
(base) > conda activate myenv
(myenv) > conda install spyder=5.5.1
Obviously multiple packages will have their version changed. Then lets say that later a new Anaconda release appears which still uses Spyder 5.4.3.
Question: I can update my base environment without issue Iām sure but to also keep running Spyder 5.5.1 in myenv would I run the following?
(base) > conda install anaconda
(base) > conda activate myenv
(myenv) > conda install anaconda
(myenv) > conda install spyder=5.5.1
Iād actually recommend creating a new environment and working out of there. If something gets messed up with base it means reinstalling - if something gets messed up with a separate environment, you can just create a new one without having to reinstall. It is good to keep conda up to date in your base environment though (conda update conda).
This will get you an environment with the latest versions of the packages included in the Anaconda installer (including Spyder 5.5.1). The last step launches Spyder from your myenv environment.
As time passes, conda update anaconda will also work as you expect in this environment and should update Spyder to the latest.
Crystal, thank you for explaining this in more detail. Iām on older programmer but new to python. And your response was very helpful to me in understanding what the error is actually saying. Iām still trying to get the hang of this package management.