I want to create a new R environment using anaconda. Following this page 'https://docs.anaconda.com/anaconda/user-guide/tasks/using-r-language/' I created an environment called eeEnv_r using this command in anaconda prompt conda create -n r_env r-essentials r-base. However the environment that was created looks like it was python environment. But when I type conda list I see some r packages such as dplyr appearing in addition to some python packages. Also there is python.exe file in environment folder. Any ideas why this is ?
I am trying to use VS code to run R, since I am familier with the IDE (used for python work). Also I want to create environments in R and then use those environment ins VS code (similar to python).
r-base depends on glib``notebook, which depends on python, therefore installing the latest r-base package will always pull in a python interpreter as well.
I would look at this from a different angle: with conda there is no such thing as a python or r-environment environments can mix packages from various languages. For most use cases this should not be a problem.
Related
I want to use Anaconda to provide separate isolated environments, each with different combinations of r-packages. If this was Python, I would specify an environment .yml file with Python Anaconda packages where those exist, and pip-ones for those that are not in Anaconda.
For R, a similar situation exist, some R packages are not in Anaconda. If I do install.packages("package_name") the packages end up in my user homedir (on windows in Documents/R/win-library...). This is not ideal, because these installed packages are not confined within the Anaconda environment and can be seen from all Anaconda environments.
Two questions:
How can I specify these (non-Anaconda r-packages) in the environment .yml file, if possible?
How can I install non-Anaconda r-packages so they are confined within an Anaconda environment.
In summary, I want to achieve environent isolation for R in the same manner it is achived with Python.
Regards Niels Jespersen
When developing your own R package locally on your machine with devtools, is there is an editable install option? I.e. if you make a local package in python you can pip install with -e which means that if you then change the scripts of the package then it automatically updates your package rather than working with a frozen version since (I believe) it creates pointers to scripts rather than compiled copies. The alternative of removing and reinstalling the package each time is 20 seconds of my life I could do without after each change. I know I could source(rscript) but then I would lose the fact it is a package, for example package::function would no longer work.
I tried to install R Studio (version 1.1.456) using the anaconda navigator by simply clicking on the install button. It was taking more than an hour, so I just figured it should be stuck.
I then tried to install it through the anaconda prompt but now it has also been stuck for around 30 minutes here:
What can I do to get around this?
Thank you in advance!
For various reasons up-to-date RStudio versions are not availabe on any conda channel I know. #merv's answer is the easiest solution, if you are happy to work with an older version of rstudio. Here is another suggestion, where you install RStudio outside of conda, but configure it to use a particular R installation, which is maintained in your custom conda environment. Step by step, this is how you procede:
Install the latest RStudio from the official sources
Create your custom conda environment CUSTOMENV, including an installation of r-base
conda create -n CUSTOMENV -c conda-forge r-base'>=4.0.0' ... [further packages]
Activate the conda environment
conda activate CUSTOMENV
Start RStudio from console
rstudio &
Important Note: I strongly endorse #mfakaehler's answer since all RStudio builds on Conda have effectively been abandoned. Install RStudio natively and launch from activated environment.
Create a new env instead. E.g.,
conda create --name rstudio_env -c r rstudio
Best practice for Conda is to create new envs for each project rather than using a monolithic base env. Generally, I find that the less one installs in base the better their experience with Conda will be.
I am using a Windows machine and trying to have Jupyter Notebook kernels for multiple versions of Julia (0.7.0 and 1.1.1) because package AWS does not support the latest version, but does support 0.7.0.
I had Julia 1.1.1 installed on my computer first and got something similar to the following error when I tried to install package AWS: https://github.com/JuliaLang/Pkg.jl/issues/792
Then I installed Julia 0.7.0 and was able to install AWS in the Julia 0.7.0 terminal with Pkg.add("AWS") with no problems.
In the Julia 0.7.0 terminal, I installed IJulia again with Pkg.add("IJulia") and restarted my Jupyter notebook instance. Now I'd like to use AWS via Jupyter notebook but when I create a new one, only Julia 1.1.1 appears.
I ended up having success by showing which kernels I had using jupyter kernelspec list in terminal, which showed where my other Julia kernel was located.
>>> jupyter kernelspec list
Available Kernels:
julia-1.1 C:\Users\{%USERNAME%}\AppData\Roaming\jupyter\kernels\julia-1.1
python3 C:\ProgramData\Anaconda3\share\jupyter\kernels\python3
I navigated to the file path listed after julia-1.1
Created a julia-0.7 folder in that same directory
Copied over contents from the julia-1.1 folder
Edited the kernel.json file by replacing every instance of julia-1.1.1 with julia-0.7.0
What I ended up having success with seems like a very rudimentary way to solve this problem. I'd like a more elegant way to achieve the same result, similar to when adding multiple kernels for different versions of Python. (Using both Python 2.x and Python 3.x in IPython Notebook)
Please help, thank you!
You (probably) just need to Pkg.build("IJulia") on the second Julia version.
Since Julia 0.7 the package manager uses separate directories for each version of a package, meaning that, from the package managers perspective, the package is already installed, and no downloading or building is performed when you install the same version from a different Julia version. The package manager does not know, however, that IJulia needs to be rebuilt for this new Julia version. You can trigger the build manually by Pkg.build("IJulia").
I have been using ipython notebook to run some R scripts. Now the problem is I have two R versions on my Ubuntu 14.04.
One is R.3.2.2 at /home/MYNAME/anaconda2/bin/R, another one is the R which I need for R studio,
now the problem is I want to only use R.3.3.1 for my system as I need some advanced task to be done.
I use conda uninstall r, after running this, according to the print out, a lot of R related packages is removed, if i run conda uninstall r again, it said
Fetching package metadata .......
Using Anaconda Cloud api site https://api.anaconda.org
Solving package specifications: ..........
Error: no packages found to remove from environment: /home/MyName/anaconda2
but when I run Which R again, still it is the anaconda R, if I run R in the terminal, it is still R3.2.2, anyone knows how could I remove this anaconda R version?
You probably needed to run hash -r in your session (or rehash if using zsh) to update your executables on PATH for the which command. A new terminal session would also fix the problem.
you can try conda uninstall r-base, this will remove R and all of the R-library.
The questions also implies that one cannot use anaconda R with rstudio.
On Linux you can
export RSTUDIO_WHICH_R=/home/USER/anaconda3/bin/R
and add to .profile (d/o your distro) to use rstudio with anaconda R and packages