How to install Julia in an anaconda environment? - julia

One of the main features of Anaconda is that it is language agnostic as stated in their blog:
You can create environments of any binary dependency tree (different
versions of Python, R, Julia, etc.).
Recently I switched from using virtualenv to Anaconda in Python, so I was curious to try Julia in an Anaconda environment. However, I couldn't find instructions explicit enough to install Julia successfully. First, I tried naively conda create -n julia-test julia. Obviously, it didn't work. Then I found at binstar.org a Julia package (version 0.3) with the code
conda install -c https://conda.binstar.org/wakari1 julia
However, I don't want to install Julia outside of a specific virtual environment, so I changed it to:
conda create -n julia-test -c https://conda.binstar.org/wakari1 julia
It didn't throw errors but ultimately failed to start the Julia interpreter.
So, what is the correct way of installing Julia (0.2, preferably) in an anaconda environment?
UPDATE
As of March 2018, Julia v0.6.1 is available for linux-64 on the conda-forge channel:
https://anaconda.org/conda-forge/julia
It has been set up to install packages inside <env_prefix>/share/julia/site, to maintain isolation from the user's ~/.julia user's home directory.
conda create -n julia -c conda-forge julia

As of August 2017, Julia v0.5.2 is available on the conda-forge channel:
https://anaconda.org/conda-forge/julia
It has been set up to install packages inside <env_prefix>/share/julia/site, to maintain isolation from the user's ~/.julia user's home directory.
conda create -n julia -c conda-forge julia

The blog post was indicating that conda is general enough to allow packages of any type. There are no packages for Julia yet (except for the one you found in the Wakari channel, which is specific to Wakari).
Building a conda package for Julia and probably isn't difficult. Building a streamlined way to convert Julia packages into conda packages is a bit more work.

Julia 0.4.5 (not the current latest 0.5.0) is now available from the bioconda channel.
Using anaconda (python 3.6 version) and following instructions in bioconda :
# In this order
conda config --add channels conda-forge
conda config --add channels defaults
conda config --add channels r
conda config --add channels bioconda
conda install julia
So to create the corresponding virtual environment:
conda create -n julia-env julia
Nonetheless, I did not see any additional julia libraries available yet.

As of Jan 2022, Anaconda suggests using;
conda install -c conda-forge julia
See: https://anaconda.org/conda-forge/julia

Related

Installing R development version in Conda environment

I would like to install R development version (i.e. latest daily snapshot) inside a conda environment. I haven't found any conda package that would allow me to install such a version from conda directly. I can install it from source, but I'm not sure how well that would work. Any suggestion on whether this is possible or do you know of any other preferable way to perform the installation? I'm aware I could use a container, but I'd rather avoid that option for now. Thanks!
No Anaconda Cloud channels build the R development version.
Conda is a package manager that works with non-Python packages as well. Before installing any packages, you should set up a new conda environment with conda create -n r-env (replace env-name with your desired name). Then you need to activate it with conda activate r-env. Then you can install the essential R packages with conda install r-essentials -c conda-forge.
In case you are unfamiliar with the -c flag, it tells conda to look at a specific channel when looking for your packages. -c conda-forge thus searches on the conda-forge-channel.

R fails to load igraph in conda environment

I am trying to run an RShiny app in a WSL2 installation of Ubuntu on Windows. I am no expert in R, but I feel this is a problem due to conda interaction with R. I run the following commands:
conda create -n r_env r-essentials r-base
conda activate r_env
conda install -c conda-forge r-shiny
conda install -c r r-visnetwork
conda install -c conda-forge r-dplyr
conda install -c r r-dt
conda install -c conda-forge r-igraph
conda install -c r r-leaflet
conda install -c conda-forge r-rgdal
conda install -c r r-shinydashboard
conda install -c conda-forge r-shinywidgets
conda install -c conda-forge r-shinycssloaders
conda install -c conda-forge r-igraph
When I run R and type in : library(igraph) i get:
->Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so':
but I can list it, it's there:
ll /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
-> -rwxrwxr-x 1 carlo carlo 3816608 Mar 31 15:38 /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
Did anybody encounter a similar problem?
The igraph library was meant to load correctly
(My Opinion) I would caution against the use of the r channel and the r-essentials package. The Continuum/Anaconda support for R was a good college-try, but is since outmoded and superseded by the broader CRAN support that Conda Forge provides. Users managing R environments will find a better experience ignoring any Continuum/Anaconda documentation and exclusively using Conda Forge for their R environments. (End Opinion)
Mixing channels can lead to symbol reference errors. Furthermore, sequences of ad hoc installations are subpar - instead specify through a YAML.
The following YAML file works just fine on linux-64, osx-64, and win-64 platforms:
so-igraph.yaml
name: so-igraph
channels:
- conda-forge
dependencies:
- r-base=4.1 # adjust to desired version
- r-shiny
- r-visnetwork
- r-dplyr
- r-dt
- r-igraph
- r-leaflet
- r-rgdal
- r-shinydashboard
- r-shinywidgets
- r-shinycssloaders
- r-igraph
Which can be used with
conda env create -n so-igraph -f so-igraph.yaml
conda activate so-igraph
I was having a similar problem with R on AlmaLinux, and it turned out I was missing some libraries on the OS itself, which I thought I had and that were necessary for some R packages. I think they were these, which makes sense, given that we're talking about igraph, a graphing package:
gsl-devel-2.5-1.el8.x86_64
gsl-2.5-1.el8.x86_64
openssl-1.1.1k-6.el8_5.x86_64
geos-devel-3.7.2-1.el8.x86_64
geos-3.7.2-1.el8.x86_64
proj-datumgrid-1.8-6.3.2.4.el8.noarch
proj-6.3.2-4.el8.x86_64
libtiff-devel-4.0.9-21.el8.x86_64
libgeotiff-devel-1.5.1-1.el8.x86_64
libgeotiff-1.5.1-1.el8.x86_64
Installing openblas may work, see https://github.com/conda-forge/r-igraph-feedstock/issues/19

Problems installing kb-python on R software (Windows 10)

I am trying yo install to make an RNA-seq analysis from raw-data (fastq extension) and I am trying to install kb-python by running the next lines:
conda create -y --name kb python=3.8 #create an environment, specifying python v3.8
conda activate kb #activate that newly created environment
pip install kb-python #install kb-python in the environment. Note: if this fails because of an issue with pysam, then do 'conda install pysam' then retry this line.
When I run the last line it takes many many hours (more than one day. I tried it with two PCs, one of 4GB and another one of 8GB of RAM and 300GB of storage).
Because of it takes so long the PC overheats and I have to turn off it to avoid physical damage. Any suggestion? Any alternative for performing an RNA-seq analysis.
I am following the next tutorial: https://protocols.hostmicrobe.org/conda
Many thanks!
It looks like kb-python is available through Anaconda (https://anaconda.org/bioconda/kb-python), so you could try installing with the command "conda install -c bioconda kb-python" instead. I came across the same time-intensive problem using pip. This conda install worked for me.
Your commands would look like so:
conda create -y --name kb python=3.8 #create an environment, specifying python v3.8
conda activate kb #activate that newly created environment
conda install -c bioconda kb-python #install kb-python in the environment. Note: if this fails because of an issue with pysam, then do 'conda install pysam' then retry this line.

How to install PyTorch natively on Apple M1 with Miniforge?

I'd like to run PyTorch natively on my M1 MacBook Air. I followed these instructions which say to start with
brew install miniforge
brew info miniforge confirms that I installed the osx-arm64 version, so that's fine. Then I did
conda create --name pytorch_env python=3.8
This should download and install a few packages, but when they are listed before installation I see that they are all osx-64, not osx-arm64. The same happens for the actual PyTorch installation:
conda install -c pytorch pytorch
Only osx-64 packages get installed. I completed the process and ran a sample script which confirmed that I only have the Intel version running.
I then installed universal Python 3.9.6 and tried to create an environment with Python 3.9, but this did not make a difference.
I also have an Anaconda3 installation on this machine, which is probably x86-only (the installer is).
What can I do now?
It was the leftover from my Anaconda3 installation, indeed.
I had to delete the conda initialize part in my .zshrc file. Then I reran the instructions starting from conda init zsh, and it worked.

Cant run dlib module in Python 3.6

I have installed dlib for my python 3.6 in my conda environment...but when i run a set of codes in my python idle ,it shows no module found for 'dlib'..What should I do?
Here is the easiest method to install dlib for Python in a conda environment. Note this will only install dlib for Python, you won't be able to use it for C++.
To install dlib for your conda environment, type this line in your terminal :
conda install -n <nameofyourenvironment> -c conda-forge dlib
Since the name of your env is given, you can type it without activating the conda environment.
The conda command-line interface will then tell you what changes will occur in the env. You have to accept them to install the module.
Proceed ([y]/n)? Y
Be careful, conda module installation uses a static approach when it comes to module version compatibility. Installing a new module require to downgrade other modules in order to ensure compatibility. Downgrading might remove functionnality of your downgraded modules.
Finally, to check the list of installed modules in your conda env, just type :
conda list -n <nameofyourenvironment>
Dlib should be there. If not, feel free to copy-paste here the error message you got when trying to install it.
Side note : you can find most available modules for conda here : https://anaconda.org/

Resources