floydhub/floyd-cli

requests module not found by floyd-cli even after installing it multiple times

nshdesai opened this issue · 3 comments

After installing floyd-cli with virtualenv and installing the required version of requests multiple times. Running floyd init <project_name> throws an error saying

Traceback (most recent call last):
  File "/usr/local/bin/floyd", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 637, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 829, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests>=2.12.4' distribution was not found and is required by floyd-cli

the virtualenv container that was used is using python 3 and yet it seems like floyd-cli is looking for requests in python 2.
(Am i missing something?)
Is there a fix for this problem

houqp commented

when you type python inside the virtualenv, did you get python 2 or python 3? one thing you can do to make sure floyd-cli is installed for python3 is to use pip3 command.

The virtualenv is configured to python3 and typing in pip is equivalent to typing pip3

pip --version
pip 9.0.1 from <path to directory>/lib/python3.5/site-packages (python 3.5)

and

python --version
Python 3.5.2

and when I run pip3 install -U floyd-cli

The Result is:

Requirement already up-to-date: floyd-cli in ./prdctor/lib/python3.5/site-packages
Requirement already up-to-date: requests-toolbelt>=0.7.1 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: clint>=0.5.1 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: raven in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: requests>=2.12.4 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: marshmallow>=2.11.1 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: tabulate>=0.7.7 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: click>=6.7 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: pathlib2>=2.2.1 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: pytz>=2016.10 in ./prdctor/lib/python3.5/site-packages (from floyd-cli)
Requirement already up-to-date: args in ./prdctor/lib/python3.5/site-packages (from clint>=0.5.1->floyd-cli)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in ./prdctor/lib/python3.5/site-packages (from requests>=2.12.4->floyd-cli)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in ./prdctor/lib/python3.5/site-packages (from requests>=2.12.4->floyd-cli)
Requirement already up-to-date: certifi>=2017.4.17 in ./prdctor/lib/python3.5/site-packages (from requests>=2.12.4->floyd-cli)
Requirement already up-to-date: idna<2.7,>=2.5 in ./prdctor/lib/python3.5/site-packages (from requests>=2.12.4->floyd-cli)
Requirement already up-to-date: six in ./prdctor/lib/python3.5/site-packages (from pathlib2>=2.2.1->floyd-cli)

and yet it does not work...

For some reason this problem magically disappeared after doing the same thing for like 43 times, maybe
the problem was solved after deactivating and then reactivating the virtualenv container