8000 Python 3: Dependency with cffi-generated interface can't be imported · Issue #37 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content
Python 3: Dependency with cffi-generated interface can't be imported #37
Closed
@hwright

Description

@hwright

Using this sample repository:

$ bazel test :bcrypt_test 
..........................................................
INFO: Found 1 test target...
FAIL: //:bcrypt_test (see /private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/testlogs/bcrypt_test/test.log).
INFO: From Testing //:bcrypt_test:
==================== Test output for //:bcrypt_test:
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/bazel-sandbox/9102214513008705191/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/bin/bcrypt_test.runfiles/foo/bcrypt_test.py", line 4, in <module>
    import bcrypt
  File "/private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/bazel-sandbox/9102214513008705191/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/bin/bcrypt_test.runfiles/pypi__bcrypt_3_1_4/bcrypt/__init__.py", line 25, in <module>
    from bcrypt import _bcrypt
ImportError: dlopen(/private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/bazel-sandbox/9102214513008705191/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/bin/bcrypt_test.runfiles/pypi__bcrypt_3_1_4/bcrypt/_bcrypt.so, 2): Symbol not found: _PyInt_FromLong
  Referenced from: /private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/bazel-sandbox/9102214513008705191/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/bin/bcrypt_test.runfiles/pypi__bcrypt_3_1_4/bcrypt/_bcrypt.so
  Expected in: flat namespace
 in /private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/bazel-sandbox/9102214513008705191/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/bin/bcrypt_test.runfiles/pypi__bcrypt_3_1_4/bcrypt/_bcrypt.so
================================================================================
Target //:bcrypt_test up-to-date:
  bazel-bin/bcrypt_test
INFO: Elapsed time: 16.377s, Critical Path: 0.37s
//:bcrypt_test                                                           FAILED in 0.3s
  /private/var/tmp/_bazel_hwright/a6f0babcfe493d859400aa369b17eeeb/execroot/foo/bazel-out/darwin_x86_64-py3-fastbuild/testlogs/bcrypt_test/test.log

Executed 1 out of 1 test: 1 fails locally.

I'm not sure if this specific to bcrypt, or more general (hence the issue description). Since this works under python 2, and the module API changed between them, I wonder if this is part of the same underlying problem as #33. Because we're running the import tooling inside of Bazel under python2, the wrong package gets pulled from pypi, and hence doesn't work with python 3.

If it is the same as #33, feel free to de-dupe (and make of of these a more general "python 3" issue).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0