Closed crcox closed 2 years ago
This should work; it worked on my own machine now.
$ git clone https://github.com/stsievert/salmon.git
$ cd salmon
$ pip install -r offline.txt # see file below
$ pip install .
Let me know if this works for you; if it does, I'll post this example on the documentation with a disclaimer.
Interesting, it's not working for me with the same error as before. While attempting to do this, I began by creating and activating a fresh virtual environment with Python 3.7.3. I upgraded pip, wheel, and setuptools and pulled the latest from salmon github before running pip install -r offline.txt
. This completed without error. Then I ran pip install .
from within my local clone of the salmon repo while on the main branch, which also completed without error.
Then I started a python interpreter and attempted to import OfflineEmbedding
as shown in the docs.
(venv-py373) [chriscox@relearn0 GitHub]$ python
Python 3.7.3 (default, Mar 17 2021, 11:57:12)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from salmon.triplets.offline import OfflineEmbedding
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chriscox/tmp/venv-py373/lib/python3.7/site-packages/salmon/__init__.py", line 2, in <module>
from .backend import app as app_algs
ModuleNotFoundError: No module named 'salmon.backend'
I repeated the exercise with Python 3.9.9 with the same outcome:
Python 3.9.9 (main, Dec 13 2021, 11:35:51)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from salmon.triplets.offline import OfflineEmbedding
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chriscox/tmp/venv-py3.9.9/lib/python3.9/site-packages/salmon/__init__.py", line 2, in <module>
from .backend import app as app_algs
ModuleNotFoundError: No module named 'salmon.backend'
Hm... I can't reproduce. A couple questions:
which pip
and which python
return?python -c 'import salmon; print(salmon.__file__)'
return?salmon.yml
specifies:https://github.com/stsievert/salmon/blob/aa9b703227814178372ed79f5813c8b4559741a1/salmon.yml#L8
[chriscox@relearn0 salmon]$ git pull
Already up to date.
[chriscox@relearn0 salmon]$ cd ~/
[chriscox@relearn0 ~]$ pyenv install 3.8.12
[chriscox@relearn0 ~]$ pyenv rehash
[chriscox@relearn0 tmp]$ cd tmp/
[chriscox@relearn0 tmp]$ pyenv local 3.8.12
[chriscox@relearn0 tmp]$ python -m venv venv-py3.8.12
[chriscox@relearn0 tmp]$ source venv-py3.8.12/bin/activate
(venv-py3.8.12) [chriscox@relearn0 tmp]$ pip install --upgrade pip setuptools wheel
(venv-py3.8.12) [chriscox@relearn0 tmp]$ pip install -r ~/GitHub/salmon/offline.txt
(venv-py3.8.12) [chriscox@relearn0 tmp]$ pip install ~/GitHub/salmon
(venv-py3.8.12) [chriscox@relearn0 tmp]$ which pip
~/tmp/venv-py3.8.12/bin/pip
(venv-py3.8.12) [chriscox@relearn0 tmp]$ which python
~/tmp/venv-py3.8.12/bin/python
(venv-py3.8.12) [chriscox@relearn0 tmp]$ python -V
Python 3.8.12
(venv-py3.8.12) [chriscox@relearn0 tmp]$ python -c 'import salmon; print(salmon.__file__)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/__init__.py", line 2, in <module>
from .backend import app as app_algs
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/backend/__init__.py", line 1, in <module>
from .core import app
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/backend/core.py", line 16, in <module>
from salmon.frontend.utils import ServerException
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/frontend/__init__.py", line 1, in <module>
from .private import *
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/frontend/private.py", line 40, in <module>
from . import plotting
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/frontend/plotting.py", line 17, in <module>
from .utils import get_logger, image_url
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/frontend/utils.py", line 14, in <module>
logger = get_logger(__name__)
File "/home/chriscox/tmp/venv-py3.8.12/lib/python3.8/site-packages/salmon/utils.py", line 32, in get_logger
assert out.parent.exists()
AssertionError
Good, I'm glad the exception is in Salmon now.
Try pip install -e .
instead of pip install .
, a hacky fix for now.
That seems to work! Thank you!
Note for the future: Salmon writes log files to out/
. To allow Salmon to pip-installable, Salmon should write logs to salmon/out/
.
I don't have conda or anaconda (or miniconda) on the machine where I want to compute offline embeddings. The documentation indicates that salmon should be installed as:
I attempted to just ignore that and just install with
pip
. Attempts toimport salmon.triplets.offline
fail.What is the simplest way to generate an offline embedding? I am hesitant to install anaconda alongside my existing package manager.