Search code examples
pythoncondaenvironmentdevelopment-environment

Clone conda environment with Tensorflow and other packages


I have created an environment using conda and set up tensorflow along with a few other packages. How do I clone this environment such that it is a direct replica of the environment itself?

I plan to clone the environment (call it base) twice: Once for testing packages and again for production. In total I would have the base environment, the test version, and production version. The goal being I can test out packages in "test" and if they work, add them to production. If they really do work as expected, add them to "base". With that being said, I am not savy with the command line and get tripped up easily with naming conventions. Any explicit answers would be very helpful.


Solution

  • Hi Jack i think the best way would be to use this command:

    conda create --name cloned_env --clone original_env
    

    cloned_env --> is the new conda environment

    original_env --> is the new conda environment we are cloning

    Another smart way to do this would be by creating a requirements.txt that contains all the packages with their version from the environment you want to clone.

    And then use that file to install the packages in the new enviroment.