Search code examples
condaenvironment

conda InvalidVersionSpec: Invalid version error when tryin to install from requirements.tct file


I created a requirements/txt file from a conda environment, usin conda.

The files looks like:

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
aiohttp=3.8.4=pypi_0
aiosignal=1.3.1=pypi_0
asgiref=3.6.0=pypi_0
async-timeout=4.0.2=pypi_0
attrs=22.2.0=pypi_0
beautifulsoup4=4.11.1=pypi_0
boto3=1.26.54=pypi_0
botocore=1.29.54=pypi_0
bzip2=1.0.8=he774522_0

When I try to create the env in other computer with conda create --name langchain --file requirements-langchain.txt

I get the followinf error message: InvalidVersionSpec: Invalid version ' 3 . 8 . 4 ': invalid character(s)

Can't understand how this fails being all done with Conda.

Any clues welcome. Thanks!


Solution

  • pypi in the build strings clearly indicates not everything was done with conda. Only YAML environment definitions fully support capturing and recreating when PyPI is mixed in. Try:

    ## export to YAML
    conda env export -n langchain > langchain-environment.yaml
    
    ############
    
    ## recreate from YAML
    conda env create -n langchain -f langchain-environment.yaml