2

I'm not able to get yaml 0.2.5 installed into a virtual environment using conda. I've first created a very basic yml file with just python 3.8.5 and yaml 0.2.5 listed as the dependencies: [![foo.yml][1]][1]

And then I create a virtual environment based on that yaml file: [![foo env][2]][2]

When I activate and then list the contents of that environment, yaml 0.2.5 is listed: [![foo env list][3]][3]

But then when I start up a python REPL and try to import the yaml package, it says that the package doesn't exist: [![python][4]][4]

And if I go to Anaconda3/envs/foo/Lib/site-packages, yaml is NOT listed: [![foo/Lib/site-packages listing][5]][5]

I'm thoroughly perplexed about why yaml won't get installed in this virtual environment. (I've tried this with other packages, and haven't run into similar issues. It appears to only be happening with the yaml package.)

Any help figuring out what's going on, would be greatly appreciated. Thanks. [1]: https://i.stack.imgur.com/OgFut.png [2]: https://i.stack.imgur.com/ZZFNK.png [3]: https://i.stack.imgur.com/mMVtz.png [4]: https://i.stack.imgur.com/kx4fJ.png [5]: https://i.stack.imgur.com/fjbT3.png

kxp
  • 43
  • 1
  • 6
  • Python yaml package is called `pyyaml`, even though the import is called `yaml`, so try installing that to your conda environment instead. – Tzane Sep 16 '21 at 13:51

1 Answers1

3

As @Tzane already mentioned yaml is called pyyaml.

use,

conda install -c anaconda pyyaml

To download pyyaml.

Links to official conda and PyPi mentions of yaml.

  • Thanks Deera and @Tzane. – kxp Sep 16 '21 at 15:03
  • marking as correct answer or upvoting will be appreciated – Deera Wijesundara Sep 16 '21 at 15:49
  • Thanks Deera and @Tzane. This was very confusing. Mostly because I need to specify the version in the environment file, and yaml==0.2.5 is NOT the correct version (even though there's a yaml 0.2.5 listed in the conda base env list). Furthermore, pyyaml==0.2.5 is also NOT the correct version. https://pyyaml.org/ was helpful to identify the correct version. Specifying pyyaml==5.3.1 in my environment.yml file, however, worked nicely. Thanks again! – kxp Sep 16 '21 at 16:43