twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
276 stars 90 forks source link

0.7.0/master fails to build with python 3.7, can't find std_memory.pxd #78

Open smalyshev opened 4 years ago

smalyshev commented 4 years ago

I'm getting this when trying to install either master or 0.7.0:

running install
running bdist_egg
running egg_info
writing python_rocksdb.egg-info/PKG-INFO
writing dependency_links to python_rocksdb.egg-info/dependency_links.txt
writing requirements to python_rocksdb.egg-info/requires.txt
writing top-level names to python_rocksdb.egg-info/top_level.txt
cythoning rocksdb/_rocksdb.pyx to rocksdb/_rocksdb.cpp
/home/ec2-user/python-rocksdb/.eggs/Cython-3.0a3-py3.7-linux-x86_64.egg/Cython/Compiler/Main.py:344: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/ec2-user/python-rocksdb/rocksdb/_rocksdb.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...
from cpython.bytes cimport PyBytes_Size
from cpython.bytes cimport PyBytes_FromString
from cpython.bytes cimport PyBytes_FromStringAndSize
from cpython.unicode cimport PyUnicode_Decode

from std_memory cimport shared_ptr
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:15:0: 'std_memory.pxd' not found

This happens on both Linux and macos. 0.6.9 release from pypi installs fine. The file is there, so not sure why Python isn't happy.

smalyshev commented 4 years ago

If I replace all imports with relative ones, e.g.

from .std_memory cimport shared_ptr

it seems to work.

davidecrs commented 4 years ago

Hi, I have the same problem but for much more libraries. The errors triggered on this command

python3 setup.py bdist_wheel

Ubuntu version: bionic Python version: 3.6.9

This is a small example of the involved libraries

Error compiling Cython file:
------------------------------------------------------------
...
from cpython.bytes cimport PyBytes_Size
from cpython.bytes cimport PyBytes_FromString
from cpython.bytes cimport PyBytes_FromStringAndSize
from cpython.unicode cimport PyUnicode_Decode

from std_memory cimport shared_ptr
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:15:0: 'std_memory.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from cpython.bytes cimport PyBytes_Size
from cpython.bytes cimport PyBytes_FromString
from cpython.bytes cimport PyBytes_FromStringAndSize
from cpython.unicode cimport PyUnicode_Decode

from std_memory cimport shared_ptr
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:15:0: 'std_memory/shared_ptr.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from cpython.bytes cimport PyBytes_FromString
from cpython.bytes cimport PyBytes_FromStringAndSize
from cpython.unicode cimport PyUnicode_Decode

from std_memory cimport shared_ptr
cimport options
       ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:16:8: 'options.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from cpython.bytes cimport PyBytes_FromStringAndSize
from cpython.unicode cimport PyUnicode_Decode

from std_memory cimport shared_ptr
cimport options
cimport merge_operator
       ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:17:8: 'merge_operator.pxd' not found
jansegre commented 4 years ago

I've run into this issue too. Though it seems to build fine if I force Cython version to be <0.30, it probably has to do with Cython releasing versions 3.0a* (https://github.com/cython/cython/releases). I wish Cython version wasn't unbound on setup.py. Sadly I don't know how to force the Cython version when installing python-rocksdb from pip.

cordawyn commented 4 years ago

I was getting same errors, but upgrading pip (and friends) helped here.

pip install -U pip setuptools wheel
fgimian commented 4 years ago

I was getting same errors, but upgrading pip (and friends) helped here.

pip install -U pip setuptools wheel

This helped on Fedora 32 here too, thanks!

Thanks Fotis