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

IOError when importing nacl.public #26

Closed
abspoel opened this issue Jul 20, 2013 · 0 comments · Fixed by #35
Closed

IOError when importing nacl.public #26

abspoel opened this issue Jul 20, 2013 · 0 comments · Fixed by #35
Milestone

Comments

@abspoel
Copy link

abspoel commented Jul 20, 2013

Ran into this problem when importing nacl.public, after installing through PyPI. I think I've solved it now, but posting for comments and future reference. System: OSX 10.8.3.

import nacl.public
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyNaCl-0.1.0-py2.7-macosx-10.8-x86_64.egg/nacl/public.py", line 6, in
from . import nacl, encoding
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyNaCl-0.1.0-py2.7-macosx-10.8-x86_64.egg/nacl/nacl.py", line 77, in
lib = ffi.verify("#include <sodium.h>", libraries=["sodium"])
File "/Users/mark/org/src/cffi/cffi/api.py", line 311, in verify
lib = self.verifier.load_library()
File "/Users/mark/org/src/cffi/cffi/verifier.py", line 68, in load_library
self.compile_module()
File "/Users/mark/org/src/cffi/cffi/verifier.py", line 55, in compile_module
self._write_source()
File "/Users/mark/org/src/cffi/cffi/verifier.py", line 117, in _write_source
file = open(self.sourcefilename, 'w')
IOError: [Errno 2] No such file or directory: '/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyNaCl-0.1.0-py2.7-macosx-10.8-x86_64.egg/nacl/pycache/_cffi__xc7279a62x20a28d1e.c'

The problem persisted when installed directly from sources, however, when running the python process as root there was no error. Also, when installing with sudo python setup.py develop, running python as the user owning the source folder didn't cause any error.

After debugging the issue and searching online, I found a section in the cffi docs, with which I managed to solve the issue, by adding

ffi.verify("...", ext_package='nacl')

to the setup.py file.

This was referenced Oct 5, 2013
@warner warner added this to the v0.3.0 milestone Mar 4, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants