This is similar to #789 but not quite the same. To reproduce, let's setup three different Python 3.6 environments
- Conda environment
test_numpy_requests with isort, requests, numpy
- Conda environment
test_numpy with isort, numpy
- Venv created using the Python in 1 with only
isort (e.g. created with 1 activated using python -m venv /tmp/venv_from_conda)
Now let's use the following file (henceforth called isort_bug.py):
import numpy
import requests
As expected, isort -c -rc isort_bug.py exits successfully:
(test_numpy_requests) calebh@devfair020:~/scratch$ cat isort_bug.py
import numpy
import requests
(test_numpy_requests) calebh@devfair020:~/scratch$ isort -c -rc isort_bug.py
(test_numpy_requests) calebh@devfair020:~/scratch$
Also as expected (based on #789), isort -c -rc isort_bug.py does not exit successfully because requests isn't installed:
(test_numpy) calebh@devfair020:~/scratch$ isort -c -rc isort_bug.py
ERROR: /private/home/calebh/scratch/isort_bug.py Imports are incorrectly sorted.
(test_numpy) calebh@devfair020:~/scratch$
The interesting bit happens with the last env
(test_numpy_requests) calebh@devfair020:~/scratch$ /tmp/venv_from_conda/bin/python -m isort -c -rc isort_bug.py
(test_numpy_requests) calebh@devfair020:~/scratch$ /tmp/venv_from_conda/bin/python -m pip list
Package Version
---------- -------
isort 4.3.21
pip 18.1
setuptools 40.6.2
You are using pip version 18.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(test_numpy_requests) calebh@devfair020:~/scratch$
Neither numpy nor requests are installed!
But what happens if you invoke it from base? (If you want to be really sure, try it in a fresh conda env with absolutely nothing installed)
(base) calebh@devfair020:~/scratch$ /tmp/venv_from_conda/bin/python -m isort -c -rc isort_bug.py
ERROR: /private/home/calebh/scratch/isort_bug.py Imports are incorrectly sorted.
(base) calebh@devfair020:~/scratch$
Why does this matter? Well nox creates virtualenvs for each session, so when I run things locally everything is fine because I have everything installed. But when I run in CI, isort complains.
This is similar to #789 but not quite the same. To reproduce, let's setup three different Python 3.6 environments
test_numpy_requestswithisort,requests,numpytest_numpywithisort,numpyisort(e.g. created with 1 activated usingpython -m venv /tmp/venv_from_conda)Now let's use the following file (henceforth called
isort_bug.py):As expected,
isort -c -rc isort_bug.pyexits successfully:Also as expected (based on #789),
isort -c -rc isort_bug.pydoes not exit successfully becauserequestsisn't installed:The interesting bit happens with the last env
Neither
numpynorrequestsare installed!But what happens if you invoke it from
base? (If you want to be really sure, try it in a fresh conda env with absolutely nothing installed)Why does this matter? Well
noxcreates virtualenvs for each session, so when I run things locally everything is fine because I have everything installed. But when I run in CI,isortcomplains.