-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
library(slendr) throwing error after installing #110
Comments
Hello, This is a strange bug. I don't think I've seen this in the time I've spent with reticulate. The What system do you use? I'm not entirely sure how to proceed from this, because the only piece of information from this error is that (presumably) some reticulate script is getting killed. I have no idea what the Can you check that you can run some code from the tutorial to reticulate? For instance, something involving creating an environment via reticulate like this? At least that way we will know what the problem is and if it really is reticulate, you could follow up with reticulate folks. |
Running code from the reticulate tutorial did not throw any errors but I now found two other examples of people reporting the same/similar issues: [https://github.com/rstudio/reticulate/issues/1218] and [https://github.com/rstudio/rstudio/issues/11263] - it seems the reticulate folks aren't responding to any issues unfortunately. The error throwing the file path to the .sh script is also weird because this .sh script does not exist but the tmp folder e.g.
|
Thanks for reporting with more details. This is incredibly frustrating. On one hand, I'm glad this is a reticulate bug and not a slendr bug, also because there's a higher chance someone from the reticulate team will eventually jump in and fix this. Also, it's clearly not just you having this issue, making it even more likely that a solution will eventually pop up. It does appear as if a reticulate X conda interaction could be a problem here? How comfortable are you with R and Python things from a more technical perspective? One solution might be to drop conda altogether and try basic Python virtualenv solution. (I don't like conda anyway and use it in slendr only because it works also on Windows... despite not being a Windows user). Basically, you could try to create a normal Python virtual environment and try linking your R session to that, before loading slendr. One way is the standard One issue is to ensure that msprime, tskit, pyslim are installed at their right versions. If they are not, slendr could break in strange ways. I don't allow custom Python environments precisely because I need 100% control about what versions of Python modules slendr uses. Then, if you have a Python virtual environment setup with necessary dependencies, you could try to activate that environment manual using I say "should" because at that point we're really in uncharted territory and I'm not sure I'd be able to help with slendr-Python related issues in that case. Still, this is the best work-around I have for now, unless the reticulate folks fix whatever bug is causing the Python (or their Python setup) script to be killed and it also assumes the problem lies with conda. This is why I'm recommending to use normal boring Python virtual environment which personally never failed me (unlike conda). To recap. You could try:
|
Actually, let's introduce another step between 3. and 4.: 3.5 Run |
So an (unsatisfactory) update - just to be certain I had not done something weird with my python install I uninstalled and reinstalled python on my machine (an M1 mac running MacOS Monterey v12.5.1) - from here on the python install I used is in What I realised is that this issue may be specific to the M1 mac because on reinstalling python and trying to newly install msprime, tskit, pyslim, and numpy I ran into a number of pip issues which I think relate to the M1 chipset. e.g. errors starting with The only way I could find to install these now was to open a new terminal with Rosetta (for others looking to do the same here is a good guide: https://apple.stackexchange.com/questions/409746/run-everything-in-rosetta-2-on-silicon-mac). Installing msprime, tskit, pyslim, and numpy in the rosetta terminal (e.g. with
To double-check I tested whether I could import msprime in this way in a regular terminal window but I can not and instead get the following error:
This seems to suggest that msprime will only run (at least on my machine from the Rosetta terminal). Knowing this I still tried to create a virtual environment (with pyenv) within the Rosetta terminal and in a new environment I tried to install msprime etc. there but ran into a compatibility issue with the original The same happened with reticulate but some other errors suggested a bigger problem about how reticulate is accessing python. Despite specifying Any advice you would have would be great but I think I may be at a bit of a loss here it also seems like reticulate and R studio have not always played well together (rstudio/reticulate#1062 so this could be another reason for the reticulate issues but I even tried using older versions of R studio but this did not fix my problem). |
Hello! I have a related issue with an error being thrown upon loading the package:
I had installed slendr and was working my way through the tutorials and then when I needed the msprime-1.2.0, tskit-0.5.2, pyslim-1.0 python packages, I ran Thanks!! |
Hey @hmoots, Yes, I've seen this error a couple of times. Still not sure what causes it but it seems that either the Python environment gets broken during the installation or its an issue with how R links to that Python environment. I have noticed this sometimes happens when a user tries to run a Python-backed slendr function before a Python environment is actually created. Almost as if R itself (or the R interface to Python, i.e. not slendr) "remembered" somewhere that a Python environment should already be created... when it isn't. :( Worse still, this happens only sometimes for some users, most other users don't get this issue. :( Either way, this pulls the rug from under slendr and there is (currently) no way how it can solve this by itself "from the inside". Because the problem does, indeed, occur outside of slendr. One sure way to solve this that I have found is to obliterate the broken Python environment and re-create it again. For instance, on my machine I would first run this:
After identifying the path to the broken Python environment I would then run
Then, in a new R session, I would do the standard
and proceed with installing a fresh new Python environment. This helped every single time so far. |
Hello @bodkan - thanks so much! I had indeed tried to run a Python-backed slendr function before creating the Python environment. I have tried to follow the code you shared, but I am getting this error:
I think it's an issue with the underscore, because the full path is: Do you know a way to handle this? I'm using the latest R update (R 4.2.1) Thanks so much for your help! |
Update: I just ran the ccommand in my terminal and it worked (don't know what I didn't think of that before!). And the new Python environment with setup_env() seems to have installed okay. Many thanks - looking forward to using slendr! |
Hi there,
I am trying to use slendr and although the installation using
install.packages("slendr")
seems to work fine when trying to load the library usinglibrary(slendr)
I get the following error:I am running R version 4.2.1 (2022-06-23) and from what I can find this likely relates to reticulate doing something odd (a similar error is discussed here: rstudio/reticulate#1155) but I cant seem to figure out a work around - any advice would be greatly appreciated,
Rishi
The text was updated successfully, but these errors were encountered: