olofk / edalize

An abstraction library for interfacing EDA tools
BSD 2-Clause "Simplified" License
621 stars 183 forks source link

Install failure; dependencies missing, consider gracefully checking versions #258

Open gojimmypi opened 3 years ago

gojimmypi commented 3 years ago

I tried installing edalize via the instructions from my fresh fork but I saw an error that looked dependency-related: Note there's a ContextualVersionConflict warning about Jinja2. This is on WSL, so admittedly perhaps not the ideal environment.

gojimmypi:~
$ cd /mnt/c/workspace
gojimmypi:/mnt/c/workspace
$ git clone https://github.com/gojimmypi/edalize.git
Cloning into 'edalize'...
remote: Enumerating objects: 2848, done.
remote: Counting objects: 100% (500/500), done.
remote: Compressing objects: 100% (232/232), done.
remote: Total 2848 (delta 303), reused 422 (delta 257), pack-reused 2348
Receiving objects: 100% (2848/2848), 781.26 KiB | 829.00 KiB/s, done.
Resolving deltas: 100% (1764/1764), done.
gojimmypi:/mnt/c/workspace
$ cd edalize
gojimmypi:/mnt/c/workspace/edalize
$ python3 -m pip install -e .
Obtaining file:///mnt/c/workspace/edalize
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1025, in check_if_exists
    self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 472, in get_distribution
    dist = get_provider(dist)
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 344, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 783, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 2.10 (/usr/lib/python3/dist-packages), Requirement.parse('Jinja2>=2.11.3'), {'edalize'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 521, in _prepare_file
    req_to_install.check_if_exists()
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1036, in check_if_exists
    self.req.name
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 472, in get_distribution
    dist = get_provider(dist)
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 344, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 783, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 2.10 (/usr/lib/python3/dist-packages), Requirement.parse('Jinja2>=2.11.3'), {'edalize'})
gojimmypi:/mnt/c/workspace/edalize
$ python3 --version
Python 3.6.9
gojimmypi:/mnt/c/workspace/edalize
$ python --version
Python 2.7.17
gojimmypi:/mnt/c/workspace/edalize

Here's the result of pip freeze

$ pip freeze
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
apio==0.4.0
appdirs==1.4.3
asn1crypto==0.24.0
certifi==2018.11.29
chardet==3.0.4
click==6.7
colorama==0.4.1
configparser==4.0.2
contextlib2==0.6.0.post1
cryptography==2.1.4
distlib==0.3.0
enum34==1.1.6
filelock==3.0.12
functools32==3.2.3.post2
gyp==0.1
i2cdriver==0.0.3
idna==2.6
importlib-metadata==1.5.2
importlib-resources==1.4.0
intelhex==2.2.1
ipaddress==1.0.17
jsonmerge==1.5.2
jsonschema==2.6.0
keyring==10.6.0
keyrings.alt==3.0
mercurial==4.5.3
packaging==19.0
pathlib2==2.3.5
pycrypto==2.6.1
pygobject==3.26.1
PyJWT==1.7.1
pyparsing==2.3.1
pyserial==3.4
pyusb==1.0.2
pyxdg==0.25
requests==2.21.0
scandir==1.10.0
SecretStorage==2.3.1
semantic-version==2.6.0
singledispatch==3.4.0.3
six==1.11.0
tinyprog==1.0.23
tqdm==4.30.0
typing==3.7.4.1
urllib3==1.24.1
virtualenv==20.0.14
zipp==1.2.0

and pip3 freeze:

$ pip3 freeze
alabaster==0.7.12
apio==0.5.4
asn1crypto==0.24.0
attrs==17.4.0
Automat==0.6.0
Babel==2.6.0
bitarray==0.8.3
blinker==1.4
certifi==2020.4.5.1
chardet==3.0.4
click==6.7
cloud-init==21.1
colorama==0.4.3
command-not-found==0.3
configobj==5.0.6
constantly==15.1.0
crcmod==1.7
cryptography==2.1.4
distro-info===0.18ubuntu0.18.04.1
docutils==0.14
ecdsa==0.13
fx2==0.6
glasgow===6c47f86
graphviz==0.5.2
httplib2==0.9.2
hyperlink==17.3.1
i2cdriver==0.0.4
idna==2.9
imagesize==1.1.0
incremental==16.10.1
Jinja2==2.10
jsonpatch==1.16
jsonpointer==1.10
jsonschema==2.6.0
keyring==10.6.0
keyrings.alt==3.0
language-selector==0.1
libusb1==1.7
-e git+https://github.com/enjoy-digital/litedram@639a31fdd20b8c47efbfa9d92457626a807eec25#egg=litedram
-e git+https://github.com/enjoy-digital/liteeth@53c9eb91a56fa824ac931fc5c76688ab7e6e3ad0#egg=liteeth
-e git+https://github.com/enjoy-digital/liteiclink@6fdd02058fba29008c90b162e0ef707dce15ebeb#egg=liteiclink
-e git+https://github.com/enjoy-digital/litejesd204b@d4b4af9d7bed17b6e9bd139baf3b0710128df097#egg=litejesd204b
-e git+https://github.com/enjoy-digital/litepcie@b0e8383d6179ee81a708204d4db9263d6fadc6c8#egg=litepcie
-e git+https://github.com/enjoy-digital/litesata@2e5c5b12d52f695f4560ca7dd08b4170d7568715#egg=litesata
-e git+https://github.com/enjoy-digital/litescope@54488c0f4d6e9e953f1a0de3d578915a5e4ccddf#egg=litescope
-e git+https://github.com/enjoy-digital/litesdcard@2df46c42475f8a4885cf45c6d4b2404c164f24d6#egg=litesdcard
-e git+https://github.com/litex-hub/litespi.git@4b253b53166ed91e126ce9b493efe5081af3b0ee#egg=litespi
-e git+https://github.com/enjoy-digital/litevideo@41f30143075ece3fff5c33a332ed067d1837cbb3#egg=litevideo
-e git+https://github.com/enjoy-digital/litex@da7fd308477673f71ae724453f0c11e168ed4628#egg=litex
-e git+https://github.com/litex-hub/litex-boards@46f78b500212a6fae76c6977d8e1b83bce91a916#egg=litex_boards
MarkupSafe==1.0
-e git+https://github.com/m-labs/migen@b1b2b298b85a795239daad84c75be073ddc4f8bd#egg=migen
netifaces==0.10.4
oauthlib==2.0.6
packaging==19.0
PAM==0.4.2
pyaes==1.6.1
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycairo==1.16.2
pycrypto==2.6.1
Pygments==2.3.1
pygobject==3.26.1
PyJWT==1.7.1
pyOpenSSL==17.5.0
pyparsing==2.3.1
pyserial==3.4
python-apt==1.6.5+ubuntu0.5
python-debian==0.1.32
pytz==2018.9
pyvcd==0.1.4
pyxdg==0.25
PyYAML==3.12
requests==2.23.0
requests-unixsocket==0.1.5
SecretStorage==2.3.1
semantic-version==2.8.4
service-identity==16.0.0
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.8.4
sphinx-rtd-theme==0.4.3
sphinxcontrib-websupport==1.1.0
ssh-import-id==5.7
systemd-python==234
Twisted==17.9.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.8
versioneer==0.18
xdot==0.9
zope.interface==4.3.2

I tried doing this Jinja2 update. It took quite some time. Eventually it seemed to work:

gojimmypi:/mnt/c/workspace/edalize
$ pip3 install -U Jinja2
Collecting Jinja2
  Downloading https://files.pythonhosted.org/packages/80/21/ae597efc7ed8caaa43fb35062288baaf99a7d43ff0cf66452ddf47604ee6/Jinja2-3.0.1-py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 340kB/s
Collecting MarkupSafe>=2.0 (from Jinja2)
  Downloading https://files.pythonhosted.org/packages/fc/d6/57f9a97e56447a1e340f8574836d3b636e2c14de304943836bd645fa9c7e/MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: MarkupSafe, Jinja2
Successfully installed Jinja2-3.0.1 MarkupSafe-2.0.1

It looks like the next attempt was successful:

$ python3 -m pip install -e .
Obtaining file:///mnt/c/workspace/edalize
Collecting Jinja2>=2.11.3 (from edalize==0.2.5)
  Using cached https://files.pythonhosted.org/packages/80/21/ae597efc7ed8caaa43fb35062288baaf99a7d43ff0cf66452ddf47604ee6/Jinja2-3.0.1-py3-none-any.whl
Collecting MarkupSafe>=2.0 (from Jinja2>=2.11.3->edalize==0.2.5)
  Using cached https://files.pythonhosted.org/packages/fc/d6/57f9a97e56447a1e340f8574836d3b636e2c14de304943836bd645fa9c7e/MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: MarkupSafe, Jinja2, edalize
  Found existing installation: edalize 0.2.5
    Can't uninstall 'edalize'. No files were found to uninstall.
  Running setup.py develop for edalize
Successfully installed Jinja2-3.0.1 MarkupSafe-2.0.1 edalize
gojimmypi:/mnt/c/workspace/edalize

Perhaps this is a feature request to more gracefully check dependency versions and optionally prompt to automatically update them?

mithro commented 3 years ago

The pip error message indicated that your version of Jinja2 was to old as I would expect.

If you would like pip to automatically upgrade required dependencies then you need to give it a --upgrade. See https://pip.pypa.io/en/stable/cli/pip_install/#overview ;

Note that pip install prefers to leave the installed version as-is unless --upgrade is specified.

gojimmypi commented 3 years ago

there's an install_requires section that checks... do you think it would be good to prompt the user as to exactly what should be done? The error is a bit long and intimidating. Perhaps give the option to install Edalize with a similar --upgrade option that also does the pip upgrade? (btw: note that my pip needed to be specified as pip3)

imphil commented 3 years ago

pip typically does not change system-wide dependencies, and Jinja is installed in that way on your machine.

The error message isn't great and it's not how it normally looks. But either way, this is something edalize cannot do anything about, since we use the standard ways to install packages. Most likely something is wrong in your Python installation. I'd recommend asking in a general Python forum, since I don't really have more insight into what's going on here.