swirldev / swirl

:cyclone: Learn R, in R.
http://swirlstats.com
Other
1.13k stars 600 forks source link

Swirl and rstudio in Conda/Anaconda #656

Open josousa82 opened 6 years ago

josousa82 commented 6 years ago

I´m making this comment for future readers tat may have the same issue I had when installing swirl on rstudio on an enviroment in conda. I instaled the package wich had more downloads on Anaconda repository, of R, and last version of rstudio, and in those versions there were missing some dependencies, and I was unable to install any packages on rstudio. In fact the missing package was some libs that reside con stringi, I believe, and I got a nasty error, and it was a bit diffcult for me to find de work arround for this, so I can use swirl on rstudio and in fact, be able to install packages. I have tried to install sintri and the missing libraries in several forms (Linux Mint Sonya version), and still got the same error. but finally my last try worked, I found a package with an older version of rstudio, and with all dependencies, and libraries that were needed to run studioo and install the packages, after that it was easy, I installed stringi, and swirl and worked!!! It seems that conda/anaconda is widelly used by datascientists, so it would be good to have a good integration of swirl and this type of tools. For what it matters the working packages, that you have to install from anaconda to be able to run swirl, or install stringi in conda are in Anaconda repo with name under:

hope this is usefull

mesamiked commented 6 years ago

I experienced a similar difficulty while installing swirl from RStudio on my Ubuntu Mate system on an AMD64 computer. The swirl error occurred during the build of the "testthat" package, and was solved by separately installing the "r-testthat" package with the conda install command. For completeness, this is my procedure: I had previously installed the anaconda package (for Python usage) to a separate environment named "anaconda3" in my Home Directory (~). I later installed the anaconda "r-essentials" package to this environment by: 1. In a terminal, cd to the ~/anaconda3/bin directory and entering "source activate" (no quotes) to reset the system PATH to point to this environment. 2. From this terminal I entered "conda install -c r-essentials" . RStudio and R were then available. The swirl package was successfully added by: 1. In a terminal, cd to the ~/anaconda3/bin directory, enter "source activate" and call RStudio with "rstudio". 2. In the RStudio console window, type " install.packages("swirl") " . The package downloaded, the installation started, but never completed - the error message stating that "testthat" could not be built. 3. I ultimately installed the "r-testthat" package separately from a second terminal in ~/anaconda3/bin (after a "source activate") with the entry "conda install -c r r-testthat" . No errors! The anaconda r-essentials installation likes the r- prefix to the package name! 4. Returning the RStudio console window, a reentry of "install.packages("swirl") " completed the package installation. 5. In the console window, entering " library("swirl") ", followed by " swirl() " activated the program. I would imagine that the same sequence will work with Windows or any other operating system. The keys appear to be the call to the "activate" method to set the PATH to the anaconda environment in your computer, and to specify the r- prefix in the package name called with "conda install " if you used the anaconda r-essentials sequence of installing R. Hope this helps.