0

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

user3848207
  • 3,737
  • 17
  • 59
  • 104

2 Answers2

2

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.

merv
  • 67,214
  • 13
  • 180
  • 245
  • Thanks for the answer. However, I have tested that after running `conda install "conda-forge::selenium[version='>=4.1']"`, selenium will still be upgraded back to v3 if I run `conda --update all`. – user3848207 May 01 '22 at 01:17
  • 2
    @user3848207 then use pinning (see https://stackoverflow.com/a/62748267/570918) – merv May 01 '22 at 18:24
  • As @merv mentioned pin your package. Open the `anaconda3` directory, go into `conda-meta` and create a file called `pinned.` Inside the file put in 1 line: `selenium>=4.1` and test again. If you have an environment setup go into `envs` and inside the correct one, go into the `conda-meta` folder there and save your `pinned` file. – Matt May 07 '22 at 18:51
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 anaconda3\envs 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.

Matt
  • 2,602
  • 13
  • 36
  • Thank you very much for the answer. I have verified that it works! I've marked your answer as the correct one and more than happy to give you the bounty points that you so deserve :) – user3848207 May 09 '22 at 02:29