I am new in the Unix environment.I have a small problem, due to some problem which i don't really get I had to create an new Conda environment and now I wonder if I can transfer all the packages from my old environment to the new (or i need to install them again? )
thanks in advance for your help
If you want to duplicate an env (say foo_env) in a new env (bar_env) you can use
conda create --clone foo_env --name bar_env
If you already have a new env (bar_env), and want to install packages from an existing env (foo_env) you can use
conda env export --name foo_env > foo.yaml
conda env update --name bar_env --file foo.yaml
Note that the conda env commands don't prompt for changes, so make sure to check the foo.yaml to verify that you really do want all the packages installed. Be aware that it will replace any duplicate packages if it involves a version change.
Related
I'm trying to figure out how Julia packages work since I like having containerized environments. I'm really struggling with it.
In python, I'd do something like conda create env --name ds to make an environment and then to install containerized packages I'd use conda activate ds; conda install <packages>.
I'm not having much success trying to get Julia to make a virtual environment.
From the Julia REPL I can type ] to go to package managers then I can create an enviornment with activate ds. From here I can add important packages add IJulia DataFrames Plots
At this point, my environment becomes actual folders which is good.
What I then don't know how to do is to activate my environment so that I can then run using IJulia; notebook()
From the REPL if I type activate ds it doesn't know what I'm talking about, even if I do cd("ds"); activate . it still doesn't know what I'm trying to do...
I looked at the docs and it seems to detail out how to manipulate packages but I haven't found anything helpful for actually running them.
You have to write activate ds (or activate . if you are already in the ds directory) in the package manager mode that is started with ] as you have commented.
Alternatively you can activate environments when you start Julia. Just write
julia --project=.
(if you are already in the ds directory).
Here https://github.com/bkamins/PyDataGlobal2020 you have a step by step example how to run things for a sample project.
A third option is to activate the environment via the package manager API e.g. like this
using Pkg
Pkg.activate(".")
I hava a conda environment called test and a requirements file-requirements.txt.
What i need to achieve is that i need to check the versions of different packages against those in requirements.txt and display which are upto date and which are not.
I need to write a python script for the task. For eg: if requirements.txt has django==2.0.6, i have to check against the installed version of django in the test environment and display accordingly.
The steps that i thought are :
Activating the environment inside script
running "conda list" command and saving all the packages along with their versions in a map as key-value pairs
matching against the requirements.txt
How to activate the environment inside a python script using "conda activate test" and run the command "conda list"?
conda list accepts the argument -n to specify an environment like this:
conda list -n test
so no need to activate the conda env
Is there some way to tell jupyter notebook what the default conda env should be when creating new notebooks? Launching it on AWS Deep Learning AMI's gives me a pretty long list, but I really only care about one specific env.
If you go to your terminal first and activate the virtual environment:
$ source venv/bin/activate
or
$ conda activate venv
for conda environment.
And after that step, do the following:
$ jupyter notebook
And when you make a new script it should give you the option for chosing python3/python2, chose the one that solves your purpose. And this script will be using the activated environment. You can check it by importing a libraray specific to that environment.
I have created multiple Conda envs which I use as IPython kernels in Hydrogen for Atom using the following suggestion:
source activate thisenv
python -m ipykernel install --user --name thisenv
After deleting such a Conda env, however, Atom-Hydrogen still gives me that kernel as an option to select from when compiling the code.
How does one unlink or remove a Conda env after it is linked as a kernel to Atom-Hydrogen?
The original command you ran was to register your env as a kernel, which on OS X results in creating a folder in a common area, like so
/Users/<user>/Library/Jupyter/kernels/thisenv
If you only want to deregister the environment (but not delete it), you can simply delete the thisenv folder from this directory (or wherever the equivalent folder is on other systems). It is not necessary to remove the environment from Conda.
If you're having trouble finding where the env is registered, you can use the kernelspecs package to locate all the available kernels. This is the package that Atom uses to find kernels.
Does anyone know how to set custom.css in for a conda environment?
I created a new environment using
conda create -n myenv
But it doesn't use the same custom.css I created in the default environment.
Any idea where I should put the custom.css file to get Jupyter to use it?
I'm using Windows 7.
See the docs here for info on where paths are located by default (for conda you'd probably be looking at the {sys.prefix}/etc/jupyter path).
Or you could just run jupyter --paths in your conda environment shell to find out where it is looking for custom files.