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

Importing scPRINT v2.0.0 fails with "No such file or directory" #14

Open
lazappi opened this issue Jan 13, 2025 · 9 comments
Open

Importing scPRINT v2.0.0 fails with "No such file or directory" #14

lazappi opened this issue Jan 13, 2025 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@lazappi
Copy link

lazappi commented Jan 13, 2025

Describe the bug

Importing scprint fails with a "No such file or directory" error

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scprint
→ connected lamindb: anonymous/main
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/scprint/__init__.py", line 3, in <module>
    from .model.model import scPrint
  File "/usr/local/lib/python3.10/dist-packages/scprint/model/__init__.py", line 1, in <module>
    from .model import *
  File "/usr/local/lib/python3.10/dist-packages/scprint/model/model.py", line 24, in <module>
    from . import decoders, encoders, fsq, loss, utils
  File "/usr/local/lib/python3.10/dist-packages/scprint/model/utils.py", line 404, in <module>
    class WeightedMasker:
  File "/usr/local/lib/python3.10/dist-packages/scprint/model/utils.py", line 408, in WeightedMasker
    TFs: list[str] = utils.fileToList(FILEDIR + "/../../data/main/TFs.txt"),
  File "/usr/local/lib/python3.10/dist-packages/scprint/utils/utils.py", line 53, in fileToList
    with open(filename) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/dist-packages/scprint/model/../../data/main/TFs.txt'

It seems like the data/ directory containing TFs.txt isn't installed with the package:

root@41d356636499:/workspace# ls /usr/local/lib/python3.10/dist-packages/scprint/
VERSION  __init__.py  __main__.py  __pycache__  base.py  cli.py  model  tasks  tokenizers  trainer  utils

Desktop (please complete the following information):

  • OS: Linux (Docker)
  • Version: 2.0.0
@lazappi lazappi added bug Something isn't working help wanted Extra attention is needed labels Jan 13, 2025
@jkobject
Copy link
Collaborator

Hello, Wow sorry, I just saw this issue, I don't know why I don't get notified. Can you install it from git directly? git pull ... as it is in the github. I think I need to add it to pypi manually otherwise

@jkobject
Copy link
Collaborator

I will make a new release with a solution for this.

@jkobject jkobject mentioned this issue Jan 29, 2025
Merged
@jkobject
Copy link
Collaborator

it should be solved now with version 2.1.0

@lazappi
Copy link
Author

lazappi commented Jan 31, 2025

I just tried this with v2.1.0 and get the same error. Again, looking at the installation directory there is no data/ folder, only what is in scprint/. Is there something different you need to do to install the data files?

This is what I did to install it in a fresh conda environment:

mamba create -n scprint python==3.10
mamba activate scprint
pip install scprint
pip list | grep scprint
# scprint                   2.1.0

And then in Python:

Python 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:24:10) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scprint
✓ wrote new records from public sources.yaml to /home/luke/.lamin/bionty/versions/sources_local.yaml!

if you see this message repeatedly, run: import bionty; bionty.base.reset_sources()
! schema module 'wetlab' is not installed → no access to its labels & registries (resolve via `pip install wetlab`)
→ connected lamindb: laminlabs/lamindata
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/__init__.py", line 6, in <module>
    from .model.model import scPrint
  File "/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/model/__init__.py", line 1, in <module>
    from .model import *
  File "/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/model/model.py", line 24, in <module>
    from . import decoders, encoders, fsq, loss, utils
  File "/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/model/utils.py", line 404, in <module>
    class WeightedMasker:
  File "/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/model/utils.py", line 408, in WeightedMasker
    TFs: list[str] = utils.fileToList(FILEDIR + "/../../data/main/TFs.txt"),
  File "/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/utils/utils.py", line 53, in fileToList
    with open(filename) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint/model/../../data/main/TFs.txt'

This is what is in the installation directory:

$ ls /home/luke/miniforge3/envs/scprint/lib/python3.10/site-packages/scprint
__init__.py  __main__.py  __pycache__  base.py  cli.py  model  tasks  tokenizers  trainer  utils  VERSION

@jkobject jkobject reopened this Jan 31, 2025
@jkobject
Copy link
Collaborator

Sh*t, sorry. I am back at it then. Please use the git (git clone .. or pip install git+....) version in the meantime.

@jkobject
Copy link
Collaborator

jkobject commented Feb 10, 2025

Hello, were you able to make it work with git clone / pip install git+?

@jkobject
Copy link
Collaborator

this has been debugged and tested on 2.1.1

@jkobject jkobject reopened this Feb 10, 2025
@jkobject
Copy link
Collaborator

@lazappi let me know if there is anything else I can do to make scprint work on the open problems benchmark (I was wondering what the "foundation model" benchmark was) and if it could be added to the denoising task as well.

@lazappi
Copy link
Author

lazappi commented Feb 11, 2025

I haven't had a chance to check with 2.1.1 or from GitHub yet. If you wanted to open a PR updating the version on one of the tasks (maybe batch integration) that would be helpful.

The foundation model task is still a work in progress but it will combine results from other tasks to give an overview of foundation models. I think we added scPRINT to denoising as well but we haven't done a run of that benchmark yet to update the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants