0

So I recently updated an old macbook pro up to Mojave (osx 10.14) and decided to use it as a side laptop for development. Using python 3.7, I created a virtualenv like so:

python3.7 -m venv myvirtualenv

Pulled the repo I am working on, enabled my virtualenv and started installing requirements:

billiard==3.6.1.0
boto3==1.9.248
botocore==1.12.248
celery==4.3.0
certifi==2018.8.24
chardet==3.0.4
defusedxml==0.5.0
dj-database-url==0.5.0
Django==2.2
django-appconf==1.0.3
django-autoslug==1.9.6
django-celery==3.3.1
django-cors-headers==3.1.0
django-heroku==0.3.1
django-mailing==0.1.3
django-storages==1.7.2
django-otp==0.5.0
django-redis-cache==2.1.0
django-templated-mail==1.1.1
djangorestframework==3.8.2
djangorestframework-jwt==1.11.0
djoser==1.7.0
docutils==0.15.2
idna==2.7
importlib-metadata==0.23
jmespath==0.9.4
kombu==4.6.5
more-itertools==7.2.0
oauthlib==2.1.0
Pillow==6.2.0
psycopg2==2.8.3
PyJWT==1.6.4
python-dateutil==2.8.0
python-http-client==3.2.1
python3-openid==3.1.0
pytz==2018.5
redis==3.3.8
requests==2.19.1
requests-oauthlib==1.0.0
rest-social-auth==1.4.0
s3transfer==0.2.1
sendgrid==6.1.0
six==1.11.0
social-auth-app-django==2.1.0
social-auth-core==1.7.0
sqlparse==0.3.0
urllib3==1.23
vine==1.3.0
gunicorn==19.9.0
whitenoise==4.1.4
zipp==0.6.0
django-celery-beat==1.5.0

Thing is, pip refuses to install this versions and force me to use updated packages. For example, I cant install Django 2.2.12 (only 3.0.5 and onwards):

    pip install django==2.2.12
    Looking in indexes: https://pypi.python.org/pypi/
    Collecting django==2.2.12
      ERROR: Could not find a version that satisfies the requirement django==2.2.12 **(from versions: 3.0.5)**
    ERROR: No matching distribution found for django==2.2.12

Same for pretty much all the packages on my requirements.

Ive tested with several python versions (from 3.4 to 3.8) and several pip ones (from 10 to 20, downloading the get-pi.py script and running it). I am pretty sure I am using the correct python and pip versions on every venv created. All of the above works perfectly on a outdated el capitan macbook, so I sense there is a problem related to the OSX. Pip verbose log is (pip 20.0.2):

  pip install -vvv django==2.2.12
    Non-user install because user site-packages disabled
    Created temporary directory: /private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-ephem-wheel-cache-ouaeti4l
    Created temporary directory: /private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-req-tracker-3hfud6vs
    Initialized build tracking at /private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-req-tracker-3hfud6vs
    Created build tracker: /private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-req-tracker-3hfud6vs
    Entered build tracker: /private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-req-tracker-3hfud6vs
    Created temporary directory: /private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-install-s86u8lbh
    Looking in indexes: https://pypi.python.org/pypi/
    1 location(s) to search for versions of django:
    * https://pypi.python.org/pypi/django/
    Fetching project page and analyzing links: https://pypi.python.org/pypi/django/
    Getting page https://pypi.python.org/pypi/django/
    Found index url https://pypi.python.org/pypi/
    Starting new HTTPS connection (1): pypi.python.org:443
    https://pypi.python.org:443 "GET /pypi/django/ HTTP/1.1" 301 122
    Starting new HTTPS connection (1): pypi.org:443
    https://pypi.org:443 "GET /pypi/django/ HTTP/1.1" 301 213
    https://pypi.org:443 "GET /project/django/ HTTP/1.1" 301 213
    https://pypi.org:443 "GET /project/Django/ HTTP/1.1" 200 14886
      Skipping link: not a file: https://pypi.org/project/Django/#content (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/help/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://donate.pypi.org (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/account/login/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/account/register/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/project/Django/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/project/Django/#description (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/project/Django/#history (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/project/Django/#files (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.djangoproject.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://code.djangoproject.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://github.com/django/django (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.djangoproject.com/fundraising/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://docs.djangoproject.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://libraries.io/pypi/Django (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://packaging.python.org/guides/analyzing-pypi-package-downloads/ (from https://pypi.org/project/Django/)
      Skipping link: unsupported archive format: .com: mailto:foundation%40djangoproject.com (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/user/apollo13/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/user/carltongibson/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/user/felixx/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/user/jacobian/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/user/ubernostrum/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Development+Status+%3A%3A+5+-+Production%2FStable (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Environment+%3A%3A+Web+Environment (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Framework+%3A%3A+Django (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Intended+Audience+%3A%3A+Developers (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=License+%3A%3A+OSI+Approved+%3A%3A+BSD+License (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Operating+System+%3A%3A+OS+Independent (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Programming+Language+%3A%3A+Python (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3 (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3+%3A%3A+Only (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3.6 (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3.7 (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3.8 (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Topic+%3A%3A+Internet+%3A%3A+WWW%2FHTTP (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Topic+%3A%3A+Internet+%3A%3A+WWW%2FHTTP+%3A%3A+Dynamic+Content (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Topic+%3A%3A+Internet+%3A%3A+WWW%2FHTTP+%3A%3A+WSGI (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Topic+%3A%3A+Software+Development+%3A%3A+Libraries+%3A%3A+Application+Frameworks (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/search/?c=Topic+%3A%3A+Software+Development+%3A%3A+Libraries+%3A%3A+Python+Modules (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/project/Django/#data (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://docs.djangoproject.com/en/stable/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://code.djangoproject.com/newticket (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://en.wikipedia.org/wiki/Wikipedia%3AIRC/Tutorial (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://groups.google.com/group/django-users (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://docs.djangoproject.com/en/dev/internals/contributing/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/help/#project-release-notifications (from https://pypi.org/project/Django/)
      Skipping link: unsupported archive format: .5: https://pypi.org/project/Django/3.0.5/ (from https://pypi.org/project/Django/)
      Skipping link: unsupported archive format: .13: https://pypi.org/project/Django/2.0.13/ (from https://pypi.org/project/Django/)
      Skipping link: unsupported archive format: .12: https://pypi.org/project/Django/2.0.12/ (from https://pypi.org/project/Django/)

      Skipping link: not a file: https://packaging.python.org/installing/ (from https://pypi.org/project/Django/)
      Found link https://files.pythonhosted.org/packages/a9/4f/8a247eee2958529a6a805d38fbacd9764fd566462fa0016aa2a2947ab2a6/Django-3.0.5-py3-none-any.whl (from https://pypi.org/project/Django/), version: 3.0.5
      Skipping link: not a file: https://pypi.org/project/Django/#copy-hash-modal-b9735743-a7e7-4ab4-95f0-c6f4582855ff (from https://pypi.org/project/Django/)
      Found link https://files.pythonhosted.org/packages/ed/52/1f281f39fe38d10c6c73e1c1d26a0aad5406be1108bf5f50423751ea8aa3/Django-3.0.5.tar.gz (from https://pypi.org/project/Django/), version: 3.0.5
      Skipping link: not a file: https://pypi.org/project/Django/#copy-hash-modal-e74730bd-b9a1-4d5a-aa25-3f2ee7cd20c3 (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/project/Django/#modal-close (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pip.pypa.io/en/stable/reference/pip_install/#hash-checking-mode (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://packaging.python.org/tutorials/packaging-projects/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://packaging.python.org/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://twitter.com/PyPI (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://dtdg.co/pypi (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.python.org/dev/peps/pep-0541/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/sponsors/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/help/#feedback (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://github.com/pypa/warehouse (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://hosted.weblate.org/projects/pypa/warehouse/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://github.com/pypa/warehouse/graphs/contributors (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.pypa.io/en/latest/code-of-conduct/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/security/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.python.org/privacy/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/policy/terms-of-use/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://status.python.org/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.python.org/psf/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://pypi.org/sitemap/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.pingdom.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://cloud.google.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://getsentry.com/for/python (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://aws.amazon.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.datadoghq.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.fastly.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://www.digicert.com/ (from https://pypi.org/project/Django/)
      Skipping link: not a file: https://statuspage.io (from https://pypi.org/project/Django/)
    Given no hashes to check 0 links for project 'django': discarding no candidates
    ERROR: Could not find a version that satisfies the requirement django==2.2.12 (from versions: 3.0.5)
    Cleaning up...
    Removed build tracker: '/private/var/folders/dp/lsdfffdx6b19vw5ykvwwyf280000gn/T/pip-req-tracker-3hfud6vs'
    ERROR: No matching distribution found for django==2.2.12
    Exception information:
    Traceback (most recent call last):
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
        status = self.run(options, args)
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 331, in run
        resolver.resolve(requirement_set)
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
        discovered_reqs.extend(self._resolve_one(requirement_set, req))
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
        abstract_dist = self._get_abstract_dist_for(req_to_install)
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 281, in _get_abstract_dist_for
        req.populate_link(self.finder, upgrade_allowed, require_hashes)
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 249, in populate_link
        self.link = finder.find_requirement(self, upgrade)
      File "/pathtovirtualenv/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 927, in find_requirement
        'No matching distribution found for %s' % req
    pip._internal.exceptions.DistributionNotFound: No matching distribution found for django==2.2.12
kennyvivas
  • 101
  • 1
  • 8
  • Upgrade Pip to the latest and greatest and then add more verbosity to the `pip install` command (`-v`, maybe multiple), and add the log in your question, please :) – AKX Apr 02 '20 at 13:09
  • Already did. Strange that pip is skipping all repos because the .X like this: Skipping link: unsupported archive format: .12: https://pypi.org/project/Django/2.0.12/ (from https://pypi.org/project/Django/) – kennyvivas Apr 02 '20 at 13:34
  • The same Skipping link: unsupported archive format: .12: https://pypi.org/project/Django/2.0.12/ (from https://pypi.org/project/Django/) error happens with all Django versions from 1 to 3 (had to cut out most due to character limit.) – kennyvivas Apr 02 '20 at 13:35
  • Do you get a different result with `python3.7 -m pip ...`? – AKX Apr 02 '20 at 13:49
  • Exactly the same result – kennyvivas Apr 02 '20 at 14:02
  • was the laptop originally set up by Anaconda Python? if so you must use conda instead of pip. – Natsfan Apr 03 '20 at 20:13
  • Not really sure. How can I check that out? – kennyvivas Apr 04 '20 at 23:38
  • For now I just solved the emergency by manually saving the current virtualenv and then moving the entire thing to the machine (you have to tweak some of the config files). Surely this will be better if I use something like docker to make it portable (because I dont want to rely on something like cpvirtualenv). The problem is what will happen if i need to update some repo. Feels like I need to update my legacy project to django 3+ anyway – kennyvivas Apr 06 '20 at 16:22

1 Answers1

0

After some digging I found a solution that worked for me, inspired on this non related answer: Updating the pip.conf file to use https

On my /Users/USERNAME/.pip/pip.conf

[global]
index-url=https://pypi.python.org/pypi/
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

Just changed the index-url to:

index-url=https://pypi.python.org/simple/

Et voilà tout!

However I don't know if I am introducing some problems whenever I need to install more recent version of pip packages in the future. I think I'll just revert back the pip.conf to pypi if I stumble upon them.

kennyvivas
  • 101
  • 1
  • 8