{"action":"created","issue":{"url":"https://api.github.com/repos/pyca/cryptography/issues/2478","labels_url":"https://api.github.com/repos/pyca/cryptography/issues/2478/labels{/name}","comments_url":"https://api.github.com/repos/pyca/cryptography/issues/2478/comments","events_url":"https://api.github.com/repos/pyca/cryptography/issues/2478/events","html_url":"https://github.com/pyca/cryptography/issues/2478","id":116981087,"number":2478,"title":"Strange issue pip installing cryptography","user":{"login":"OOPMan","id":248980,"avatar_url":"https://avatars.githubusercontent.com/u/248980?v=3","gravatar_id":"","url":"https://api.github.com/users/OOPMan","html_url":"https://github.com/OOPMan","followers_url":"https://api.github.com/users/OOPMan/followers","following_url":"https://api.github.com/users/OOPMan/following{/other_user}","gists_url":"https://api.github.com/users/OOPMan/gists{/gist_id}","starred_url":"https://api.github.com/users/OOPMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OOPMan/subscriptions","organizations_url":"https://api.github.com/users/OOPMan/orgs","repos_url":"https://api.github.com/users/OOPMan/repos","events_url":"https://api.github.com/users/OOPMan/events{/privacy}","received_events_url":"https://api.github.com/users/OOPMan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-11-15T08:48:12Z","updated_at":"2016-01-21T04:23:24Z","closed_at":"2015-11-16T09:24:13Z","body":"Hi guys, I just encountered a rather odd series of issues with cryptography that seem to be related to pip caching the installation or something.\r\n\r\nI'll try to explain the situation quickly and how I fixed it:\r\n\r\nI'm running Ubuntu 15.10 and using the LaunchPad PyPy packages. Currently running PyPy 4.0.0 with everything in a virtualenv in my dev directory. I recently decided to start testing my Flask web app with uWSGI. At this point I discovered that the PyPy packages from LaunchPad do not include libpypy-c.so so \r\n\r\nI downloaded the PyPy 4.0.0 source and proceeded to compile my own PyPy from scratch with --shared enabled in order to generate the libpypy-c.so file. An hour and half later  have my .so file and I'm feeling lazy so I just copy it into the bin folder for my virtualenv to see if uWSGI will play ball. \r\n\r\nIt seems to, for a short time but then I run into a very odd error when attempting to do \r\n```from PIL import Image```, which generates an exception of the form \r\n```\r\nFile \"/home/adamj/Development/Tools/Python/VirtualEnv/x86_64/recomed-pypy-4.0.0-kubuntu.old/site-packages/PIL/Image.py\", line 66, in <module>\r\n    from PIL import _imaging as core\r\nImportError: cannot import name '_imaging'\r\n```\r\n\r\nThis only happens when running under uWSGI so I figured that maybe transplanting the .so file compiled on my system into the virtualenv created from the LaunchPad PyPy packages is the issue and decided to use my new custom PyPy build to create a fresh venv. \r\n\r\nA few minutes later and I have a new venv to throw at uWSGI. Start up my app except now I get a whole new error when my app attempts to make use of the Google API Python client. Specifically:\r\n```CryptoUnavailableError('No crypto library available',)```. A bit of digging in the source reveals that this is happening when oauth2client.crypt is imported by google-api-python-client. Some more digging reveals oauth2client requires either PyCrypto (A no-go for PyPy) or PyOpenSSL (Which uses cryptography). A bit more digging and experimentation reveals that something is wrong with the cryptography install in my venv. \r\n\r\nAlthough all the expected .so files are present under cryptography.hazmat.bindings, actually attempting to use them (For example, by trying https://cryptography.io/en/latest/x509/tutorial/#creating-a-certificate-signing-request-csr) fails with an error about being unable to import the bindings.\r\n\r\nWe're finally coming to the end of the tail. I tried a bunch of things including upgrading and reinstalling cryptography but with no luck. Finally, I tried the following:\r\n```\r\npip uninstall crytography\r\npip install cryptography --no-cache-dir --no-binary :all:\r\n```\r\nAfter doing this cryptography finally started working in my new venv and I was able to run my app with no errors under uWSGI.\r\n\r\nI'm not sure if this is a cryptography issue or a pip issue? Any ideas?"},"comment":{"url":"https://api.github.com/repos/pyca/cryptography/issues/comments/173447514","html_url":"https://github.com/pyca/cryptography/issues/2478#issuecomment-173447514","issue_url":"https://api.github.com/repos/pyca/cryptography/issues/2478","id":173447514,"user":{"login":"OOPMan","id":248980,"avatar_url":"https://avatars.githubusercontent.com/u/248980?v=3","gravatar_id":"","url":"https://api.github.com/users/OOPMan","html_url":"https://github.com/OOPMan","followers_url":"https://api.github.com/users/OOPMan/followers","following_url":"https://api.github.com/users/OOPMan/following{/other_user}","gists_url":"https://api.github.com/users/OOPMan/gists{/gist_id}","starred_url":"https://api.github.com/users/OOPMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OOPMan/subscriptions","organizations_url":"https://api.github.com/users/OOPMan/orgs","repos_url":"https://api.github.com/users/OOPMan/repos","events_url":"https://api.github.com/users/OOPMan/events{/privacy}","received_events_url":"https://api.github.com/users/OOPMan/received_events","type":"User","site_admin":false},"created_at":"2016-01-21T04:23:24Z","updated_at":"2016-01-21T04:23:24Z","body":"@cmutzel Did you try re-installing with the --no-cache-dir argument? If the issue is the same then that will fix it..."}}