How to modify .condarc file or use pinning to force conda to install the noarch selenium version when running “conda update –all”?

I would like to install selenium v4.1.0 on Anaconda python on Windows.

https://anaconda.org/conda-forge/selenium

If you run conda install selenium, conda will install selenium v3.11 if you’re on Windows.

I ran conda install selenium --channel conda-forge/noarch to make conda install selenium v4.1.0 which is the noarch version.

The problem is when I run conda update --all, conda will downgrade my selenium back to v3.

After some googling, I discover modifying the config file .condarc may fix this problem. Question is how to modify .condarc to force conda to install the noarch selenium version when running “conda update –all”?

I am open to other solutions like pinning that will prevent conda from downgrading selenium back to v3 when I run conda update --all

I’m using python 3.9.12, conda 4.12.0

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Conda has a sufficiently expressive specification grammar (called MatchSpec) to handle this – no need to mess around with .condarc.

conda install "conda-forge::selenium[version='>=4.1']"

It is possible that there are conflicts with the current environment, in which case, consider creating a new environment with Python 3.7 or later.

Method 2

As @merv mentioned pin your package, which is a little unclear in the linked post. Open the anaconda3 directory, go into conda-meta subfolder and create a file called pinned. Inside the file add 1 line: selenium>=4.1.0 and test again. If you have an environment setup go into anaconda3envs and inside the correct environment folder, go into the conda-meta folder there and save your pinned file. I tested it and it would keep the selenium>=4.1.0 using this method after doing a conda update --all

If you open Anaconda Prompt and type: where python it will usually show your installation directory, in case you don’t know where it installed to.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x