Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

conda environment from windows to linux

I have developed a project on windows using pycharm and I want to deploy in on an ubuntu server.

I am trying to create a requirements.txt using these commands:

conda list -e > requirements.txt
conda list > requirements.txt

Depending on the options the requirements.txt looks like any of these:

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
@EXPLICIT
https://repo.anaconda.com/pkgs/main/win-64/blas-1.0-mkl.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2018.03.07-0.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/icc_rt-2017.0.4-h97af966_0.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/intel-openmp-2018.0.3-0.tar.bz2

Or this

# packages in environment at C:\ProgramData\Anaconda2\envs\myenvs:
#
# Name                    Version                   Build  Channel
anyjson                   0.3.3            py36h1110a06_1  
arrow                     0.12.1                   py36_1  
asn1crypto                0.24.0                   py36_0  
babel                     2.6.0                    py36_0

Or this

name: myenv
channels:
  - defaults
dependencies:
  - anyjson=0.3.3=py36h1110a06_1
  - arrow=0.12.1=py36_1
  - asn1crypto=0.24.0=py36_0
  - babel=2.6.0=py36_0
  - blas=1.0=mkl

No matter how I try to do this I get errors on the ubuntu machine, in some cases because the package is for windows: (/win-64/)

https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2018.03.07-0.tar.bz2 

I have read a lot of documentation but I seem not to be able to get what I want. Conda (Python) Virtual Environment is not Portable from Windows to Linux

Any solution?

like image 762
jalazbe Avatar asked Aug 06 '18 13:08

jalazbe


People also ask

Can you share conda environment?

With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can also share an environment file.

How do you change conda environments?

You can always use conda activate or conda deactivate to switch between your environments. You can directly activate the environment you wish to use by using conda activate . conda deactivate will deactivate your current active environment and change to the default environment which is the base environment.

Can you use conda on Linux?

Conda is an open source package and environment management system that runs on Windows, Mac OS and Linux. Conda can quickly install, run, and update packages and associated dependencies. Conda can create, save, load, and switch between project specific software environments on your local computer.


2 Answers

By default, conda will export your environment with builds, but builds can be platform-specific.

A solution that worked for me is to use the --no-build flag:

$ conda env export --no-build > environment.yml

Hope this helps.

like image 146
LoicViennois Avatar answered Oct 12 '22 01:10

LoicViennois


I was handling with the same problem, I found this on Anaconda documentation:

Conda does not check architecture or dependencies when installing from a spec file. To ensure that the packages work correctly, make sure that the file was created from a working environment, and use it on the same architecture, operating system, and platform, such as linux-64 or osx-64

Managing enviroments

like image 42
Franco Vega Maza Avatar answered Oct 12 '22 01:10

Franco Vega Maza