Skip to content
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

Cannot initialize clinspacy #11

Open
athan-dial opened this issue Jul 19, 2021 · 6 comments
Open

Cannot initialize clinspacy #11

athan-dial opened this issue Jul 19, 2021 · 6 comments

Comments

@athan-dial
Copy link

I'm not having any success initializing clinspacy. It goes through the same sequence with and without the miniconda = FALSE argument. I've also tried to downgrade python to 3.6 to initial tutorial. Any idea how to get around this issue with Python version? Example of code below

> library(clinspacy)
> clinspacy_init(use_linker = TRUE)

Initializing clinspacy using clinspacy_init()...
SpaCy not found. Installing spaCy...
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
                                                                                       0:00,  5.16it/s]
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - spacy==2.3.0 -> python[version='>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
@kdpsingh
Copy link
Owner

Thank you for the comment, and my apologies for the delay in getting back to you on this.

Because clinspacy wraps spacy, scispacy, and medspacy, we essentially have to juggle a bunch of version issues between dependencies. The only issue I did not control for in clinspacy was the Python version. By default, clinspacy uses the reticulate::install_miniconda() function to install the latest version.

Based on your output, it looks like the issue is that spacy 2.3.0 (the version used in clinspacy) only supports up to Python 3.8 and not Python 3.9 whereas reticulate::install_miniconda() appears to be installing version Python 3.9.

In the short-term, I would recommend uninstalling this version of miniconda and manually installing miniconda with Python 3.8 (available here: https://docs.conda.io/en/latest/miniconda.html). That should work.

In the medium-term, I'm going to look into how to enforce which version of miniconda is installed. It looks like although scispacy currently supports spacy 3.0, medspacy still requires spacy 2.3.

@kdpsingh
Copy link
Owner

It looks like reticulate will soon allow the miniconda URL to be specified as an option() within R.

rstudio/reticulate@486f0a5

As soon as this version of reticulate lands on CRAN, I'll plan to update clinspacy with a way to install the correct version of miniconda.

@kdpsingh
Copy link
Owner

Actually, I discovered that the problem was with reticulate::conda_create(), which installs the latest version of Python (right now = 3.9) into the newly created conda environment regardless of which version of miniconda is installed.

Because spacy 2.3.0 (needed for compatibility with medspacy) only supports up to Python 3.8, this creates a problem.

This is now fixed on the GitHub version of clinspacy. By updating to a newer version of reticulate (>= 1.19), we can now specify which Python version is needed in conda_create(), so I've set this up to require Python 3.8.

To fix, run this:

reticulate::conda_remove('clinspacy')
remotes::install_github('ML4LHS/clinspacy')

Then, when you run clinspacy_init(), everything should work.

Please let me know if this fixes the issue, and I'll plan to send this version to CRAN.

@rpittman188
Copy link

I know I'm a few years late, but have you found a solution to this that still works in the updated versions of everything? I still have issues because of space 2.3.0.

@kdpsingh kdpsingh reopened this Feb 16, 2024
@jarioss92
Copy link

Hi Karandeep, I have the same problem, could you please help me?

@kdpsingh
Copy link
Owner

kdpsingh commented Mar 5, 2024

I will try to fix in the next 1-2 weeks. I haven't touched my R package codebase in a while but I will come back to this. Thank you for the ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants