0

I am using a Kivy as a Virtual Machine (in MAC OS). I am trying to install the python packages pycrypto and paramiko. Starting with pycrypto, I tried

pip install pycrypto Requirement already satisfied: pycrypto in /usr/local/lib/python2.7/dist-packages

but when I try to import it in python

>>> import pycrypto Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named pycrypto

In paramico, I get the following:

kivy@kivy-VirtualBox:~$ pip install paramiko
Collecting paramiko
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached paramiko-2.1.2-py2.py3-none-any.whl
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from paramiko)
Collecting cryptography>=1.1 (from paramiko)
  Using cached cryptography-1.7.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ZboIFP/cryptography/setup.py", line 334, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 320, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 386, in finalize_options
        ep.require(installer=self.fetch_build_egg)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in require
        items = working_set.resolve(reqs, env, installer, extras=self.extras)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 859, in resolve
        raise VersionConflict(dist, req).with_context(dependent_req)
    pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.6.0'))

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ZboIFP/cryptography/

Any suggestions?

  • maybe your default pip and default python are not related? Can you provide the output for `which pip` and `which python` (assuming you're on unix). Regarding the paramiko installation, it seems like you're trying to install the package in your system python, which, I assume has a lot of other packages installed in it. It seems like one of them requires six 1.5.2 and another >=1.6.0. You should really installs your dependencies in a virtualenv or compile python and run it in a different directory. Would that be possible? – nir0s Mar 06 '17 at 11:25
  • `kivy@kivy-VirtualBox:~$ which pip /usr/local/bin/pip kivy@kivy-VirtualBox:~$ which python /usr/bin/python` – Leonidas Souliotis Mar 06 '17 at 11:27
  • As I am new to the Unix and Python, I will try to do that! – Leonidas Souliotis Mar 06 '17 at 11:31

1 Answers1

1

From the command line try:

python 2.7 import pycrypto
  • I tried, but I got the following `kivy@kivy-VirtualBox:~$ python import pycrypto python: can't open file 'import': [Errno 2] No such file or directory ` – Leonidas Souliotis Mar 06 '17 at 11:30
  • Are you specifying the Python Version number? From your log it does not appear you have – Darren Close Mar 06 '17 at 11:32
  • `kivy@kivy-VirtualBox:~$ python --version Python 2.7.6 ` – Leonidas Souliotis Mar 06 '17 at 11:34
  • You can't run it like that. do `python -c 'import pycrypto'` – nir0s Mar 06 '17 at 11:58
  • try to create a virtualenv (install virtualenv running `pip install virtualenv`) and create a virtualenv (`virtualenv my_env`). Then, activate the virtualenv by running `source my_env/bin/activate` and then try to pip install both pycrypto and paramiko. Let me know what happens. – nir0s Mar 06 '17 at 12:01