regardscitoyens / the-law-factory-parser

Data generator for the-law-factory project
https://www.lafabriquedelaloi.fr
GNU General Public License v3.0
45 stars 9 forks source link

Dependency conflict with anpy and lxml #121

Open olivierlacan opened 5 years ago

olivierlacan commented 5 years ago

Trying this for the first time and following README instructions I can't run either tlfp-parse-many or tlfp-parse without running into the following exception:

$ tlfp-parse http://www.senat.fr/dossier-legislatif/ppl07-031.html
Traceback (most recent call last):
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 898, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 789, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (lxml 4.2.6 (/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages), Requirement.parse('lxml<4.2,>=4.1'), {'anpy'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/olivierlacan/.pyenv/versions/lafabrique/bin/tlfp-parse", line 4, in <module>
    __import__('pkg_resources').require('tlfp==0.0.1')
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 3126, in <module>
    @_call_aside
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 3110, in _call_aside
    f(*args, **kwargs)
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 596, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/Users/olivierlacan/.pyenv/versions/pypy3.5-6.0.0/envs/lafabrique/site-packages/pkg_resources/__init__.py", line 784, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'lxml<4.2,>=4.1' distribution was not found and is required by anpy

FYI, this is the output from pip list:

$ pip list
Package          Version    Location
---------------- ---------- -------------------------------------------------------------------------------------------------------
anpy             0.1.15
attrs            17.4.0
beautifulsoup4   4.6.3
certifi          2018.11.29
cffi             1.11.5
chardet          3.0.4
click            6.7
dateparser       0.7.0
diff-match-patch 20121119
future           0.16.0
greenlet         0.4.13
html2text        2018.1.9
html5lib         1.0.1
idna             2.7
lawfactory-utils 0.1.7
legipy           0.1.1
lxml             4.2.6
metslesliens     1.3.0
mistune          0.8.4
parsimonious     0.8.1
pathlib          1.0.1
pip              18.1
python-dateutil  2.7.5
python-gitlab    1.5.1
pytz             2018.9
readline         6.2.4.1
regex            2018.11.22
requests         2.20.1
senapy           0.2.13
setuptools       40.6.3
six              1.11.0
slugify          0.0.1
tlfp             0.0.1      /Users/olivierlacan/Development/oss/the-law-factory-parser
tzlocal          1.5.1
urllib3          1.22
virtualenv       16.2.0
webencodings     0.5.1
xmltodict        0.11.0

Any ideas why this conflict is occurring? I can't find a specific version dependency specified for lxml in anpy so maybe that's an issue there. Not sure since I'm not very familiar with Python.

More generally it looks like it's lawfactory-utils that's requesting a higher version of lxml:

lawfactory-utils 0.1.7 has requirement lxml<4.3,>=4.2, but you'll have lxml 4.1.1 which is incompatible.
anpy 0.1.15 has requirement requests<2.19,>=2.18, but you'll have requests 2.20.1 which is incompatible.
olivierlacan commented 5 years ago

Solved this issue by pinning lawfactory-utils to 0.1.6 which doesn't request a higher version of lxml:

pip install 'lawfactory_utils==0.1.6'
mdamien commented 5 years ago

Hi @olivierlacan, it looks like the pip install --process-dependency-links -Ue . doesn't download the up-to-date version of anpy and legipy.

You can use pip install -Ur requirements.txt to fix that, we already use it and it gives us the latest version of each dependencies (gonna add it to the README)