wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
531 stars 76 forks source link

Installation problems on Linux (Ubuntu 23.04) #155

Open ryszard314159 opened 1 year ago

ryszard314159 commented 1 year ago

I completed installation process as described in docs but I am getting an error ModuleNotFoundError: No module named 'plyvel' I guess I am missing something, but I do not know what. I would appreciate some guidance.

$ virtualenv ~/.virtualenvs/plyvel
(plyvel) $ pip install plyvel
Collecting plyvel
  Using cached plyvel-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (803 kB)
Installing collected packages: plyvel
Successfully installed plyvel-1.5.0
(plyvel) $ 
(plyvel) $ python -c 'import plyvel'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'plyvel'
(plyvel) $
(plyvel) $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:    23.04
Codename:   lunar
(plyvel) $ 
wbolster commented 1 year ago

seems you're doing the right thing πŸ€”

some ideas (typing from phone, didn't try myself):

ryszard314159 commented 1 year ago

Yes, it does.

(plyvel) $ pip install --verbose plyvel
Using pip 23.0.1 from /home/ryszard/.virtualenvs/plyvel/lib/python3.11/site-packages/pip (python 3.11)
Requirement already satisfied: plyvel in ./lib/python3.11/site-packages (1.5.0)
(plyvel) $

and

(plyvel) $ ls ./
bin  lib  plyvel  pyvenv.cfg
(plyvel) $
(plyvel) $ find ./ | grep "site-packages/plyvel" | head
./lib/python3.11/site-packages/plyvel.libs
./lib/python3.11/site-packages/plyvel.libs/libsnappy-2c75d721.so.1.1.9
./lib/python3.11/site-packages/plyvel.libs/libleveldb-e43d8649.so.1.22.0
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/RECORD
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/top_level.txt
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/WHEEL
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/REQUESTED
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/LICENSE.rst
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/INSTALLER
(plyvel) $ 
wbolster commented 1 year ago

there should also be a .so file for plyvel itself (not just the dependencies), but your output is truncated

can you try installing without pip wheel cache? it's a cmdline flag but i forgot the name – try --help. i see β€˜using cached …’ and want to rule that out.

ryszard314159 commented 1 year ago

Full log for the fresh install without cache (ModuleNotFoundError: No module named 'plyvel' still persist)

$ virtualenv ~/.virtualenvs/fresh
created virtual environment CPython3.11.4.final.0-64 in 134ms
  creator CPython3Posix(dest=/home/ryszard/.virtualenvs/fresh, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/ryszard/.local/share/virtualenv)
    added seed packages: pip==23.0.1, setuptools==66.1.1, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
$ cd ~/.virtualenvs/fresh
$ source bin/activate
(fresh) $ pip install --verbose plyvel --no-cache-dir
Using pip 23.0.1 from /home/ryszard/.virtualenvs/fresh/lib/python3.11/site-packages/pip (python 3.11)
Collecting plyvel
  Downloading plyvel-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (803 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 803.4/803.4 kB 10.5 MB/s eta 0:00:00
Installing collected packages: plyvel
Successfully installed plyvel-1.5.0
(fresh) $ python -c "import plyvel"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'plyvel'
(fresh) $ find ./ | grep "site-packages/plyvel" 
./lib/python3.11/site-packages/plyvel.libs
./lib/python3.11/site-packages/plyvel.libs/libsnappy-2c75d721.so.1.1.9
./lib/python3.11/site-packages/plyvel.libs/libleveldb-e43d8649.so.1.22.0
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/RECORD
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/top_level.txt
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/WHEEL
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/REQUESTED
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/LICENSE.rst
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/INSTALLER
./lib/python3.11/site-packages/plyvel-1.5.0.dist-info/METADATA
./lib/python3.11/site-packages/plyvel
./lib/python3.11/site-packages/plyvel/_plyvel.cpython-311-x86_64-linux-gnu.so
./lib/python3.11/site-packages/plyvel/__init__.py
./lib/python3.11/site-packages/plyvel/__pycache__
./lib/python3.11/site-packages/plyvel/__pycache__/_version.cpython-311.pyc
./lib/python3.11/site-packages/plyvel/__pycache__/__init__.cpython-311.pyc
./lib/python3.11/site-packages/plyvel/_version.py
(fresh) $ 
wbolster commented 1 year ago

weird, this all looks perfectly normal to me

csn you try

ryszard314159 commented 1 year ago
(fresh) $ which python
/home/ryszard/.virtualenvs/fresh/bin/python
(fresh) $ python --version
Python 3.11.4
(fresh) $ python -c "import sys; print(sys.path)"
['', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.11/dist-packages']
(fresh) $ 
(fresh) $ ls -lt bin/python
lrwxrwxrwx 1 ryszard ryszard 16 Sep 15 14:50 bin/python -> /usr/bin/python3
(fresh) $ 
wbolster commented 1 year ago

weird, i expected to see the venv in the import path (sys.path) but it seems missing? πŸ˜•

can you try with another library? e.g. pip install jsonlines (pure python, no depencies)

can you try not using virtualenv, but the built-in venv module? python -m venv somedir etc.

ryszard314159 commented 1 year ago

weird, i expected to see the venv in the import path (sys.path) but it seems missing?

Yes, apparently.

This works:

(fresh) $ export PYTHONPATH=$PWD/lib/python3.11/site-packages
(fresh) $ python -c "import plyvel"
(fresh) $
wbolster commented 1 year ago

cool, that's progress.

does it happen with venv (not virtualenv) as well?

(virtualenv mentioned in the docs is a leftover from the python 2.x era. stdlib venv mostly suffices these days)

ryszard314159 commented 1 year ago

Apparently the same problem with python3 -m venv sys.path is not updated properly...

$ python3 -m venv VENV
$ cd VENV/
$ ls
bin  include  lib  lib64  pyvenv.cfg
$ source bin/activate
(VENV) $ pip install plyvel
Collecting plyvel
  Using cached plyvel-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (803 kB)
Installing collected packages: plyvel
Successfully installed plyvel-1.5.0
(VENV) $ python -c "import plyvel"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'plyvel'
(VENV) $
(VENV) $ python -c "import sys; print(sys.path)"
['', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.11/dist-packages']
(VENV) $
ryszard314159 commented 1 year ago

Does it work for you? Is it something peculiar to my setup?

ryszard314159 commented 1 year ago

Thank you for this nice and useful app!

wbolster commented 1 year ago

i just tried myself, and it works fine for me. i suspect this has something to do with your setup (or with ubuntu packaging). can you try a few more things using fresh directories etc:

before creating a venv:

after creating a venv and activating it:

and please do the above with both virtualenv and built-in venv