ContinuumIO / anaconda-issues

Anaconda issue tracking
646 stars 220 forks source link

R channel packages errors, libgcc_s_seh-1.dll is missing #777

Closed Diego-MX closed 7 years ago

Diego-MX commented 8 years ago

Dear Anacondians, I have an issue when running R from the Anaconda environment. I set it up to be used with Jupyter and I also set RStudio to use that install. This is in a Windows 7 machine.

The error appears when running R with Jupyter, RStudio and even from the console. The window title is R term.exe System error and reads the following,

The program can't start because libgcc_s_seh-1.dll is missing from your computer. 
Try reinstalling the program to fix this problem. 

I did reinstall R, r-essentials and r-irkernel with conda install, and now I'm looking at what else to do... Please let me know if you need further info.

Regards,

Diego-MX commented 8 years ago

I did some experimentation. The R session by itself doesn't show that message, but it does when loading some of Hadley's libraries from Rprofile.site, these are dplyr, ggplot2, tidyr but not others like stringr, lubridate, magrittr.

The Jupyter and RStudio session do show the message even when disabling those packages.

In addition, the console and RStudio session do start, but the Jupyter one gets stuck after the corresponding errors.

This suggests that the issue is related to some specific packages.

mingwandroid commented 8 years ago

Hi @Diego-MX, can you paste your Rprofile.site please?

Diego-MX commented 8 years ago
options(help_type="html")

# set a CRAN mirror
local({r <- getOption("repos")
     r["CRAN"] <- "https://cran.revolutionanalytics.com/"
     options(repos=r)})

# Give a fortune cookie, but only to interactive sessions
if (interactive()) fortunes::fortune()

library(lubridate)
library(magrittr)
library(stringr)
library(stats)   # Manipulate STATS to be imported before DPLYR. 

#library(dplyr,   warn.conflicts = FALSE)
#library(ggplot2, warn.conflicts = FALSE)
#library(tidyr,   warn.conflicts = FALSE)
mingwandroid commented 8 years ago

OK, I know what the issue is and can give you a workaround for now.

Issue

Our R interpreter needs an entry adding to its PATH environment to function correctly and I do that in the shim R.exe executable for Conda that's in the <env>\Scripts\ folder.

I will have to make this modification to the actual R interpreter itself I think.

Workaround

From cmd.exe (or you could set you global Windows PATH but that's kind of horrible):

set PATH=<env>\Library\mingw-w64\bin;%PATH%
"C:\Program Files\RStudio\bin\rstudio.exe"

A batch file could also be used to do this.

Let me know if this workaround is acceptable for you in the short term. I'll leave this issue open until the correct fix is implemented.

Diego-MX commented 8 years ago

I see something changed, but it's still not fixed. (。◝‿◜。)
When starting an R Jupyter notebook, I don't get the message anymore. However, the kernel does get stuck and I am still getting the message when starting RStudio or loading the libraries.

If it helps, the message from the kernel is:

Error in loadNamespace(...): there is no package called 'digest'
Calls: tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
KernelRestarter: restarting kernel (1/5)

I installed the corresponding package individually, and then I get a new .dll issue.

Error: .onLoad failed in loadNamespace() for 'pbdZMQ', details:
    error: Could not load C:/.../library/pbdZMQ/libs/x64/libzmq.dll
In addition: Warning message:
    bytecode verssion mismatch; using eval
mingwandroid commented 8 years ago

Hi @Diego-MX, I'm having trouble reproducing these problems, would you mind pasting the output from:

conda list --export please. Are you still having trouble launching R from the console? If so, what R.exe are you running? Have you activated your conda environment? I think the full steps from opening a cmd.exe Window would be be helpful.

Diego-MX commented 8 years ago

Oh. I see. Launching RStudio doesn't take into account the PATH=...-line.

I'm launching the console from the Anaconda menu, that activates the environment straight up.

I copied the line you recommended removing the end of line and substituting <env> for my Anaconda location. Then I started R both directly in the terminal and through Jupyter.

R does open, but it shows an error when loading the corresponding libraries. The engine corresponds to Anaconda's based on R.home() command.

I pasted the output of conda list --export in this pastebin.

Diego-MX commented 8 years ago

I apologise, the command was run incorrectly. After removing quotes, I do get R started with Jupyter but still get a different dll message when importing the libraries.

Rterm.exe - Entry Point Not Found
The procedure entry point Rf_installChar could not be located in the 
dynamic link library R.dll. 
mingwandroid commented 8 years ago

Somehow, you have a mix of old and new R packages (3.1.3 and 3.2.4). I can reproduce this if I ask conda to install r-assertthat. Investigations continue.

Diego-MX commented 8 years ago

True. I've had issues with package versions and locations since early on. They go back to understanding how RStudio and Jupyter can coexist together and set them up with Anaconda's R engine.

The cost of this was more than one installation, and inconsistencies with the packages.

Still I'm confused that I cannot reinstall the packages.

For instance I do: conda install -c r r-dplyr and I get a simplified output:

Warning: 8 possible package resolutions:
  -r-asserthat-0.1-0.tar.bz2, r-dbi-0.3.1-r3.2.4_0.tar.bz2, ...
...
Package plan for installation in environment C:\...\Anaconda3:
The following packages will be UPDATED:
  r-asserthat: 0.1-r3.2.4_0 --> 0.1-0 
  ...

After proceed, I'm still getting the same error, as if nothing has been updated. Running the command again shows the same plan for installation.

Diego-MX commented 8 years ago

If you think this situation is more messy than it is enlightning, I'm okay doing a clean install of either the R component, or the whole Anaconda. ¯_ȌᴥȌ_/¯

mingwandroid commented 8 years ago

There's definitely things for me to investigate and fix here. When I do, I might ask you to go from clean again, yeah, but for now we'll see.

Diego-MX commented 8 years ago

Sure thing. Thanks.

mingwandroid commented 8 years ago

Hi @Diego-MX, if you can clean your environment and try again I'd appreciate it.

Then take care that all r-packages that Conda installs have r3.2.4 in their name, and if not please report back here. The exception to this is r-essentials.

Diego-MX commented 8 years ago

Are there flags like conda uninstall r-*? That is basically what I did, except typing one by one.

There are bad news.

Sequence of events:

Results:

About error:

This is the error that I started with before posting this. That is to say libbz2-1.dll was missing before libgcc_s_seh-1.dll did. The former is more viperous because it won't allow R to start, while the latter does start past the errors.
I had been able to pass by the first one with conda install -c r r, but that won't help now.

I hope this helps.

mingwandroid commented 8 years ago

Add <anaconda ...>\mingw-w64\bin to PATH as mentioned before, and be able to start Jupyter without errors; RStudio still broken.

When you added this to PATH, how did you then launch RStudio? From the same cmd.exe shell? That is a necessary step.

Diego-MX commented 8 years ago

Right, that was misleading information as I did run it from the icon... hence expecting it to fail. If I type "..\..\Program Files\RStudio\bin\rstudio.exe" on the command I do get a functioning IDE!

(•̀ᴗ•́)൬༉

mingwandroid commented 8 years ago

Ok great. Are you OK with this workaround for now?

Diego-MX commented 8 years ago

Yes, thank you.
It was interesting too.

synapticarbors commented 8 years ago

I just wanted to report that I've run into the same issue and the work-around posted seems to resolve things for me as well. Looking forward to a more permanent fix.

mingwandroid commented 8 years ago

OK, thanks for the feedback @synapticarbors.

switch527 commented 8 years ago

Has there been a more perm solution to this? The way this conda installation is set up just doesn't make much sense to me and after several installations I am having the same problem. I need it to work with R Studio, Jupyter, and Beaker notebook, but the way the installation sets everything up there is no way to get Beaker to recognize it. In every other language and every other build of R i just have to point the config file to where the binaries and executable are and bam, it works. But with this build there are library folders in envs/r/Library, but theres another at env/r/R/library. and there are binary folders everywhere. I can;t make head or tails of how this functions or how to get an IDE to connect to it. I wanted to get my company to transition to conda R to go with our installations of Anaconda2 & 3 but I can;t even get it to work on my laptop because it keeps telling me that I'm missing this or that when I try and fire it up.

rcgalbo commented 8 years ago

Having the same issue issue with both Rstudio and when attempting to launch r using jupyter notebook

files supposedly missing:

mingwandroid commented 8 years ago

You are meant activate the conda environment first from the cmd.exe command prompt. If you do that, then launch jupyter or RStudio (from that same cmd.exe command prompt) then your PATH will have the right values.

PCdLf commented 8 years ago

Is there another option to start RStudio? This solution does not work for me. I have installed and reinstalled RStudio. I ran the conda/ Rstudio commands from the cmd.exe but RStudio keeps telling me that "ibbz2-1.dll" is missing. I really don't want to uninstall conda.

Thanks,

mingwandroid commented 8 years ago

I've explained what you need to do:

  1. Launch cmd.exe.
  2. \Scripts\activate.bat
  3. Run the RStudio executable (or jupyter notebook) from this command prompt.
mingwandroid commented 8 years ago

@switch527 I can give specific details of why it needs to be the way it is if you are interested, but actually the procedure for running conda's R on Windows, OS X and Linux is exactly the same, you activate the conda environment to setup the system environment.

The reason we have some extra bin folders for R on conda on Windows is because the R programming language doesn't use MSVC compilers, it uses GCC instead. On Windows, MSVC shared libraries and GCC shared libraries are incompatible with each other. This necessitates conda keeping them separate, because if it were to overwrite MSVC shared libraries with GCC ones, then the MSVC compiled executables that needed them would then fail to run. The same is true the other way around.

PCdLf commented 8 years ago

What do you mean with \Scripts\activate.bat ? That is unclear to me.

mingwandroid commented 8 years ago

@PCdLf: Each installation of Anaconda and Miniconda has a Scripts folder and inside that folder is a batch file called activate.bat. To setup the correct environment from which to run programs supplied by conda you should run that batch file. An alternative is to use the Anaconda Prompt from the Start Menu, but be aware that all this does is to launch cmd.exe and run activate.bat for you.

You can read more about activate (and deactivate) here:

http://conda.pydata.org/docs/using/envs.html#change-environments-activate-deactivate

lsorber commented 8 years ago

@mingwandroid Your solution works well and I understand why, but it's not very convenient. Isn't there a more structural way to solve this?

mingwandroid commented 8 years ago

I guess you could create your own Start Menu shortcuts based on the Anaconda Prompt and add more to them to also launch whatever you want in that environment.

But that doesn't sit well with the idea of easy, reproducible enviornments (conda create -n <env>/conda actiave <env>) which is one of conda's strong points, and changes that break this would be problematic.

You can launch Jupyter from the Anaconda Navigator: https://docs.continuum.io/anaconda/navigator and you should be able to create R notebooks from that. I am working on adding RStudio packages to conda. I hope to integrate those with Navigator too. Would this provide the convenience you are after?

PCdLf commented 8 years ago

@mingwandroid Your solution didn't work for me, but I think I know why. I had 2 versions of R installed, one in Conda, and one for Rstudio. I removed the Conda R, and now Rstudio starts again. I now use Rpy2 to communicate with R.

RodneyT272 commented 8 years ago

Thank you, @mingwandroid!

I was able to make it more convenient on Win10. I simply opened the activate.bat file in a real text editor (Notepad++ for me), added at the bottom the path to the RStudio.exe file (C:\Program Files\RStudio\bin\rstudio.exe on my machine), then saved this as a new batch file in the same location. Using Explorer's right-click, I made a shortcut to this new batch file on the desktop. Then I opened the Windows program menu, scrolled to the link for the RStudio program (not the menu folder), did a right-click, hovered over "More", and finally selected "Open file location". This opens the location "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\RStudio" on my computer. Then I moved the shortcut from the desktop to this folder. Now I can pin it to Start, and/or do a Windows-S, type in a few characters of the batch file name, and it pops right up like any other app. All this should work in a similar fashion for WIn8 and 7.

Adding RStudio to the Anaconda Navigator would be great!

covelloz commented 8 years ago

@RodneyT272 You are amazing! Your hack worked for Windows 7 too. I followed your directions exactly.

One nuance was that the shortcut wasn't immediately pinnable in Window 7. I had to right-click the shortcut > properties & then append "cmd.exe /C" to the beginning of the target field so that all-in-all the shortcut target was "cmd.exe /C C:\%your-R-path%\rstudio.bat" where rstudio.bat is the edited copy of the activate.bat file.

However, one annoying thing was that Rstudio would launch a cmd prompt and leave it open... You can manually close it without Rstudio closing, but I wasn't happy with that. THE FIX: Instead of just adding: "C:\%your-R-path%\rstudio.exe" to the bottom of the activate.bat copy (rstudio.bat), I added: cd "C:\%your-R-path%\" start rstudio.exe exit

That did the trick. Cmd prompt opens, boots Rstudio, closes itself. However, if you pin the shortcut to the task bar, it will not group with the pinned icon so you'll have two Rstudio icons in your task bar when Rstudio is open. I called it a night and just pinned it to my StartMenu... hahaha, good enough.

Thanks so much!!

NervenCid commented 7 years ago

I don't understand:

I run activate.bat and didn't worked

shall i agregate R to path?

In command prompt r works, but R studio cannot work properly

In fact the R.exe from anaconda folder don't work

covelloz commented 7 years ago

@NervenCid You need to open Rstudio.exe from the same command line prompt that the conda env with R installed was activated from. Please carefully read @mingwandroid's comments above.

NervenCid commented 7 years ago

@covelloz Hello again:

Sorry for the english: My technical knowledge is limitated, but by understood the procedure is:

1) Install Anaconda 2) Install RStudio 3)Open Comand prompt 4) Add PATH=C:\Users\user\AppData\Local\Continuum\Anaconda3\Library\mingw-w64\bin;%PATH% 5) In the same comand prompt enter "C:\Program Files\RStudio\bin\rstudio.exe" 6) So enjoy?

covelloz commented 7 years ago

@NervenCid I wouldn't recommend step 4), it is not necessary. I (personally) don't like adding extra PATH variables. You simply need to activate your conda environment before executing rstudio.exe

1)Install Anaconda 2)Open Command prompt 3)Activate the environment you want R installed -type "activate root" in the command prompt to activate your default env -otherwise, type "activate some_env" if you'd rather install R into some other env you created. 4)Install R via conda: conda install -c r r-essentials 5)Install RStudio and choose Anaconda\R\ folder as the R version you want RStudio to use. 6)(in the activated command prompt): "C:\Program Files\RStudio\bin\rstudio.exe" 7)Enjoy

Please note. Step 3) & 6) are the most important parts.

NervenCid commented 7 years ago

Thanks for your answer: The step 3 is not clear to me yet....

So i must tip:

C:/activate root

??

Shall i locate in a specific folder?

Thank you and sorry, i'm quite new in terminals

covelloz commented 7 years ago

@NervenCid No, just type "activate root" (without quotes) into the command prompt. You should see at the beginning of the command prompt after you type this into the command line. That is your cue that the root env is activated. When you install Anaconda, it adds the "activate" command into your PATH variable for you.

For more information about conda environments, please read the documents about managing environments with conda: http://conda.pydata.org/docs/using/envs.html

mingwandroid commented 7 years ago

activate root will only work if you let Anaconda add itself to the System PATH when you installed it. Personally I don't recommend letting it do that so in that case you need to enter <INSTALL_LOCATION>\Scripts\activate root. Here you do not literally enter <INSTALL_LOCATION> but replace that with where you installed Anaconda. For me, I'd enter C:\Users\ray\anaconda\Scripts\activate root

You can also run Anaconda Prompt from the Start Menu. That is the easiest way.

1rdsk1 commented 7 years ago

Hi I get error:"Rterm.exe - System Error The program can't start because liblzma-5.dll is missing from your computer. Try reinstalling the program to fix this problem." Then for other dll same missing error. I do not have RStudio but just the Annaconda install on Windows 10. I am webscraping data and so installed HTTR and XML packages from CRAN. On install I got: "Warning message: "package 'httr' was built under R version 3.3.2" Attaching package: 'httr' I wonder if that is what is causing me to get these errors. Now I cant start my R Jupyter Notebook as I have to close the terminal down sto stop the errors as the R kernel dies before trying to retart repeatedly. I tried launching Jupyter exe from Annaconda prompt as suggested but still get this problem. Rupert

mingwandroid commented 7 years ago

You cannot mix packages from CRAN with packages from conda. You can get R to build CRAN packages from source though.

This is also completely unrelated to this bug report. Please open new reports for new issues.

amirbehzad commented 7 years ago

We had the same issue in Windows 10, and we managed to run RStudio as Administrator without DLL issues.

mingwandroid commented 7 years ago

It is likely that your user account PATH has some entries in it leading to what's usually called DLL hell or perhaps you were not activating your environment correctly.

Either way, if you can use process hacker to show the list of modules loaded and PATH env var by Rcmd.exe when this happens it would be very helpful.