LDSSA / heroku-model-deploy

Deploy a scikit model using heroku and Flask
MIT License
14 stars 17 forks source link

Problems setting up virtual environent (Ubuntu) #7

Closed PedroM1 closed 6 years ago

PedroM1 commented 6 years ago

Hey I have python 3.6:

familia@familia-desktop:~/LDSSA/heroku-model-deploy$ python3 --version
Python 3.6.6

Calling pipenv on the requirements file I get this... any clue what is the problem? It also took many minutes to run. Computer details below. Thanks:

familia@familia-desktop:~/LDSSA/heroku-model-deploy$ pipenv install -r requirements.txt
Creating a virtualenv for this project...
Pipfile: /home/familia/LDSSA/heroku-model-deploy/Pipfile
Using /usr/bin/python3.6 (3.6.6) to create virtualenv...
⠋Already using interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz/bin/python3.6
Also creating executable in /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz/bin/python
Installing setuptools, pip, wheel...done.
Setting project for heroku-model-deploy-D-SL1Mzz to /home/familia/LDSSA/heroku-model-deploy

Virtualenv location: /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz
Creating a Pipfile for this project...
Requirements file provided! Importing into Pipfile...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
b/python3.6/dist-packages/pipenv/patched/piptools/resolver.py", line 74, in resolve_hashes
    return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/piptools/resolver.py", line 74, in <dictcomp>
    return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 448, in get_hashes
    for candidate in matching_candidates
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 448, in <setcomp>
    for candidate in matching_candidates
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 72, in get_hash
    hash_value = self._get_file_hash(location)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 81, in _get_file_hash
    for chunk in iter(lambda: fp.read(8096), b""):
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 81, in <lambda>
    for chunk in iter(lambda: fp.read(8096), b""):
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/notpip/_vendor/urllib3/response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/notpip/_vendor/urllib3/response.py", line 307, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pipenv.patched.notpip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

familia@familia-desktop:~/LDSSA/heroku-model-deploy$ 

-Computer- Processor : 2x Pentium(R) Dual-Core CPU E5400 @ 2.70GHz Memory : 4043MB (2541MB used) Operating System : Ubuntu 16.04.5 LTS

PedroM1 commented 6 years ago

In the end I get a Pipfile with the following, but no pip.lock file wich I though was expected:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
scipy = "*"
scikit-learn = "*"
pandas = "*"
gunicorn = "*"
peewee = "*"
"psycopg2" = "*"
Flask = "*"
category_encoders = "==1.2.6"

[dev-packages]

[requires]
python_version = "3.6"

And the shell appears to run, maybe the apparently error messages are not relevant?

familia@familia-desktop:~/LDSSA/heroku-model-deploy$ ls
app.py                     LICENSE          README.md
columns.json               pipeline.pickle  requirements.txt
Deserialize and use.ipynb  Pipfile          titanic.csv
dtypes.pickle              Procfile         Train and Serialize.ipynb
familia@familia-desktop:~/LDSSA/heroku-model-deploy$ pipenv shell
Launching subshell in virtual environment…
 . /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz/bin/activate
familia@familia-desktop:~/LDSSA/heroku-model-deploy$  . /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz/bin/activate
(heroku-model-deploy-D-SL1Mzz) familia@familia-desktop:~/LDSSA/heroku-model-deploy$
PedroM1 commented 6 years ago

Apparently does not seem to have at least pandas, or am I getting it wrong?

familia@familia-desktop:~/LDSSA/heroku-model-deploy$ pipenv shell
Launching subshell in virtual environment…
 . /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz/bin/activate
familia@familia-desktop:~/LDSSA/heroku-model-deploy$  . /home/familia/.local/share/virtualenvs/heroku-model-deploy-D-SL1Mzz/bin/activate
(heroku-model-deploy-D-SL1Mzz) familia@familia-desktop:~/LDSSA/heroku-model-deploy$ python3
Python 3.6.6 (default, Jun 28 2018, 04:42:43) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'
>>> 
PedroM1 commented 6 years ago

Resolved by creating a new folder to restart the process and installing one package at a time:

pipenv install scipy
...

And also correcting the spelling of category-encoders to category_encoders as suggested in Slack. :)