"SpecNotFound: Invalid name, try the format: user/package" in Creating new Conda env with yml file (Windows 10)
Asked Answered
U

12

25

I'm trying to Create New conda environment by 'Anaconda Prompt' usnig yml File in Windows 10.
So here is the steps i made through:

1. using cd command i changed the directory to dir which my yml file located. (suppose my yml file is in c:/Users/<USER NAME>/.jupyter )
2. Then i used conda env create -f Python 310.yml command to create new conda env.

and what i got is:

SpecNotFound: Invalid name, try the format: user/package

Now I don't know how can I solve this problem and exactly what is the meaning of this error.


Appendix

my Python 310.yml file contains these stuff:

enter image description here

Unshroud answered 7/10, 2021 at 14:9 Comment(0)
U
4

issue solved by changing contents of Python 310.yml and renaming yml file to Python310.yml. Here is the final .yml file content:

name: Python3.9 
channels:
  - defaults
dependencies:
  - numpy
  - pandas
  - matplotlib
  - pip
  - python=3.9.*      
  - python-dateutil
  - pytz
  - scikit-learn
  - scipy
  - statsmodels
  - xlrd
  - openpyxl
  - lxml
  - html5lib
  - beautifulsoup4
  - jupyter
  - pip:
    - pmdarima        
    - tensorflow
    - keras
prefix: C:\Users\Shayan\Anaconda3\envs\Python3.9
Unshroud answered 7/10, 2021 at 15:36 Comment(0)
L
37

drop the "env" in "conda env create" it's just "conda create ..."

Lilith answered 16/3, 2022 at 20:50 Comment(7)
That’s just not true - the conda create and conda env create commands have different functionality, and only the latter applies to YAML files. The former takes the output of conda list --export.Pyorrhea
Based on the official doc, Your answer isn't the correct one.Unshroud
@Unshroud could you actually post the correct answer rather than just critiquing? Alright, let me see... Okay so the docs claim that conda env create -f environment.yml is the correct command, but that literally didn't work for the OP. So try conda env create -f environment.yml if you really must, but probably the docs are out of dateHeartless
@Nathan, Here is my answer. It's good to inspect the web pages closely rather than shoot a comment recklessly.Unshroud
@Unshroud oh, I didn't realize you had also answered that. Future readers, his answer is helpfulHeartless
Although apparently most users just wanted the quick fix of this answer by Chris, so take a look if you're trying to seriously load a .yml into your conda env, which apparently most people aren'tHeartless
According to the official doc (see Shayan's link) conda env create -f creates an environment from a file, but to create it with a name you use conda create -n (without the "env" in there) which makes no sense but works for me at least.Sletten
T
7

The other answer says to:

drop the "env" in "conda env create" it's just "conda create ..."

This did not fix it for me by itself, but it did work after trying that and then after that trying the whole

conda env create -n myenv-dev --file my_env.yml

command again.

Taut answered 28/4, 2022 at 7:16 Comment(0)
U
4

issue solved by changing contents of Python 310.yml and renaming yml file to Python310.yml. Here is the final .yml file content:

name: Python3.9 
channels:
  - defaults
dependencies:
  - numpy
  - pandas
  - matplotlib
  - pip
  - python=3.9.*      
  - python-dateutil
  - pytz
  - scikit-learn
  - scipy
  - statsmodels
  - xlrd
  - openpyxl
  - lxml
  - html5lib
  - beautifulsoup4
  - jupyter
  - pip:
    - pmdarima        
    - tensorflow
    - keras
prefix: C:\Users\Shayan\Anaconda3\envs\Python3.9
Unshroud answered 7/10, 2021 at 15:36 Comment(0)
A
2

In my case I missed -f in the command.

This error message is about trying to parse something as a package name, that is not a package name. In OP's case it was 360.yml which was taken to be a separate parameter due to the space. In my case it was the whole filename, because I missed -f.

Amphicoelous answered 2/6, 2023 at 9:39 Comment(0)
D
1

In my case the problem was that the file did not exist. So make sure that the file exists before running the update command.

Dissolution answered 28/3, 2022 at 9:48 Comment(0)
R
0

You can use conda create -f Python 310.yml.

Rhubarb answered 27/11, 2021 at 4:59 Comment(1)
I mentioned that in question myself.Unshroud
R
0

Make sure your directory is in "quotes", bc I got this error having whitespace inside it...

Ranie answered 19/4, 2022 at 9:15 Comment(0)
Q
0

My solution was because I was running the following command on windows

conda env create -n spa --file .\environment.yml

and in order to get it to run on my Ubuntu WSL2 just needed a minor update:

conda env create -n spa --file environment.yml
Quinquevalent answered 19/8, 2022 at 20:40 Comment(0)
B
0

I put the name of the yml file in double quotes and used the -f= notation and powershell no longer gave me an error. For you, that might mean:

conda env create -f="Python 310.yml"
Berniecebernier answered 15/2, 2023 at 22:27 Comment(0)
P
0

This worked for me: conda env create -n 'env name' -f environment.yml

Peggie answered 17/4, 2023 at 8:44 Comment(2)
Two other answers already suggest this. Please don't repeat answers.Lilith
I did not see the same, because I tried others but I got into problems. This one worked for me.Peggie
K
0

You just have a typo...check the name of your .yml file... likely you missed something and is not recognized... put your glasses and check ownership of the file also

Klapp answered 28/7, 2023 at 17:51 Comment(1)
what's the typo?Roobbie
G
0

I have changed my file name from name.yaml to name.yml and error is gone. Looking at other solutions above, would remocommend renaming the file.

Goodbye answered 27/9, 2023 at 8:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.