Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip install causes error. Can I debug it via pdb?

Tags:

pdb

Ubuntu 16.04
Python 3.5.2

Inside a virtualenv if I run python, I get Python 3.5.2.

The problem is:

(photoarchive) admin@simple_project:~/venv/photoarchive/lib/python3.5/encodings$ pip install django-crequest
Collecting django-crequest
  Using cached django-crequest-2016.3.16.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-2qlcw5ux/django-crequest/setup.py", line 9, in <module>
        license=open('LICENSE').read(),
      File "/home/admin/venv/photoarchive/lib/python3.5/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 204: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2qlcw5ux/django-crequest/

Well, pip install ruins everything. By the way, without the virtualenv this package has installed via pip.

I'm stuck and don't know how to cope with this.

The only thing I can think of is to stop at that line 26 in ascii.py. This seems to be possible via pdb. I'm going to edit it and add pdb.set_trace() there. Then save the file.

Is it a good idea? The other question: is it possible without editing the file?

like image 425
Michael Avatar asked Oct 18 '22 09:10

Michael


1 Answers

That sure seems odd. It may be due to a corrupt download (which is being cached). To ensure a re-download, do

pip install --no-cache-dir django-crequest

If the same error occurs, try downloading the source code and edit setup.py:

mkdir tmp
pip download django-crequest --dest=./tmp
cd tmp
tar xfz django-crequest-2016.3.16.tar.gz
cd django-crequest-2016.3.16
sed -i '9 s/^/#/' setup.py  # comments out line 9 in setup.py

Now do the installation via the edited setup.py:

python setup.py install
like image 149
jmd_dk Avatar answered Oct 21 '22 05:10

jmd_dk