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

maturin develop doesn't seem to work under PyPy #595

Closed
oconnor663 opened this issue Jul 18, 2021 · 1 comment · Fixed by #596
Closed

maturin develop doesn't seem to work under PyPy #595

oconnor663 opened this issue Jul 18, 2021 · 1 comment · Fixed by #596
Labels
bug Something isn't working

Comments

@oconnor663
Copy link
Contributor

First here's the repository I'm using:

[jacko@athena3 tmp]$ git clone https://github.com/oconnor663/blake3-py
...
[jacko@athena3 tmp]$ cd blake3-py/
[jacko@athena3 blake3-py]$ git log -1 --oneline
a5e4dce version 0.2.0

Now if I try to use maturin develop under CPython, it works fine:

[jacko@athena3 blake3-py]$ venv_dir=`mktemp -d`&& virtualenv $venv_dir -p python3.9 && source $venv_dir/bin/activate
created virtual environment CPython3.9.6.final.0-64 in 116ms
  creator CPython3Posix(dest=/tmp/tmp.rh26Sx3k7A, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/jacko/.local/share/virtualenv)
    added seed packages: pip==21.1.3, setuptools==57.1.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
(tmp.rh26Sx3k7A) [jacko@athena3 blake3-py]$ python --version
Python 3.9.6                      
(tmp.rh26Sx3k7A) [jacko@athena3 blake3-py]$ pip --version                                                                                                                                      
pip 21.1.3 from /tmp/tmp.rh26Sx3k7A/lib/python3.9/site-packages/pip (python 3.9)
(tmp.rh26Sx3k7A) [jacko@athena3 blake3-py]$ maturin develop
...
(tmp.rh26Sx3k7A) [jacko@athena3 blake3-py]$ python
Python 3.9.6 (default, Jun 30 2021, 10:22:16) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import blake3
>>> blake3.__version__
'0.2.0'

But if I try the same with PyPy, it doesn't seem to work:

[jacko@athena3 blake3-py]$ venv_dir=`mktemp -d`&& virtualenv $venv_dir -p pypy3 && source $venv_dir/bin/activate                                                                          
created virtual environment PyPy3.7.10.final.0-64 in 119ms
  creator PyPy3Posix(dest=/tmp/tmp.ocogyLRCaf, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/jacko/.local/share/virtualenv)
    added seed packages: pip==21.1.3, setuptools==57.1.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
(tmp.ocogyLRCaf) [jacko@athena3 blake3-py]$ python --version
Python 3.7.10 (77787b8f4c49115346d1e9cbaf48734137417738, Jun 13 2021, 02:02:23)
[PyPy 7.3.5 with GCC 11.1.0]   
(tmp.ocogyLRCaf) [jacko@athena3 blake3-py]$ pip --version
pip 21.1.3 from /tmp/tmp.ocogyLRCaf/site-packages/pip (python 3.7)
(tmp.ocogyLRCaf) [jacko@athena3 blake3-py]$ maturin develop
...
(tmp.ocogyLRCaf) [jacko@athena3 blake3-py]$ python
Python 3.7.10 (77787b8f4c49115346d1e9cbaf48734137417738, Jun 13 2021, 02:02:23)
[PyPy 7.3.5 with GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import blake3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'blake3'

Have I missed anything important here? The output of maturin develop itself just seems to be regular Cargo build output, and I don't think there are any relevant warnings or errors, but I can include it if that's helpful. This is on Arch Linux on x86_64.

@messense
Copy link
Member

I've reproduced it with the pyo3-pure test crate.

maturin develop puts it in <PREFIX>/lib/python3.7/site-packages but that path is not in sys.path on PyPy 3.7 for whatever reasons.

>>>> import sys
>>>> sys.path
['/Users/messense/Projects/maturin/test-crates/pyo3-pure', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib_pypy/__extensions__', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib_pypy', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib-python/3', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib-python/3/lib-tk', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib-python/3/plat-darwin', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib-python/3/plat-mac', '/Users/messense/.pyenv/versions/pypy3.7-7.3.5/lib-python/3/plat-mac/lib-scriptpackages', '/Users/messense/.pyenv/versions/pypy3.7/site-packages']

If you append <PREFIX>/lib/python3.7/site-packages to sys.path it works fine.

@messense messense added the bug Something isn't working label Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants