EricssonResearch / calvin-base

Calvin is an application environment that lets things talk to things, among other things.
Apache License 2.0
282 stars 91 forks source link

pkg_resources.ContextualVersionConflict: (pyasn1 ... #79

Closed simonxuhao closed 7 years ago

simonxuhao commented 7 years ago

I installed calvin following instructions in https://github.com/EricssonResearch/calvin-base/wiki/Installation, but I get error when I run "csdocs std.Trigger" with either pyasn1 0.1.9 or 0.3.2:

> rpm -qa | grep centos-release
centos-release-7-3.1611.el7.centos.x86_64

> python --version
Python 2.7.5

> pip list --format=columns pyasn1 | grep pyasn1
pyasn1           0.1.9
pyasn1-modules   0.0.11

> csdocs std.Trigger
Traceback (most recent call last):
  File "/home/ns5/.virtualenvs/test-calvin/bin/csdocs", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 863, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyasn1 0.1.9 (/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages), Requirement.parse('pyasn1==0.3.2'), set(['pyasn1-modules']))

> pip install pyasn1 --upgrade
Collecting pyasn1
  Using cached pyasn1-0.3.2-py2.py3-none-any.whl
Installing collected packages: pyasn1
  Found existing installation: pyasn1 0.1.9
    Uninstalling pyasn1-0.1.9:
      Successfully uninstalled pyasn1-0.1.9
Successfully installed pyasn1-0.3.2

> csdocs std.Trigger
Traceback (most recent call last):
  File "/home/ns5/.virtualenvs/test-calvin/bin/csdocs", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/home/ns5/.virtualenvs/test-calvin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pyasn1==0.1.9' distribution was not found and is required by calvin

Any help would be appreciated. Thanks!

olaan commented 7 years ago

Looks like some versioning mismatch between pyasn1 and pyasn1-modules. I changed the version to >=0.1.9 on the setup branch. Could you retry and see if that fixes the issue?

I recommend installing the requirements before running setup.py.

simonxuhao commented 7 years ago

I didn't run setup.py directly. I ran "pip install -r test-requirements.txt" and then "pip install -e .".

I just retried using the following command sequence:

> deactivate && cd ~
> rm -rf ~/.virtualenvs/test-calvin/
> virtualenv ~/.virtualenvs/test-calvin
> source ~/.virtualenvs/test-calvin/bin/activate
(test-calvin)> cd calvin-base
(test-calvin)> git checkout develop
(test-calvin)> pip install -e .
(test-calvin)> pip install -r test-requirements.txt
(test-calvin)> csdocs std.Trigger
std.Trigger(tick, data)
Pass on given _data_ every _tick_ seconds

Outports: data
Requires: sys.timer.repeating

So the isue is fixed.

Question: why neither pyasn1 0.1.9 nor 0.3.2 met the requirement?

Thanks!

olaan commented 7 years ago

It looks like pyasn1-modules requires pyasn1 0.3.2, so it would not load with version 0.1.9. At the same time Calvin was set to require 0.1.9, so when 0.3.2 was installed, Calvin would not load.

One caveat; Tests have not completed, so I cannot guarantee there are no known issues.

Cheers!

-o

olaan commented 7 years ago

Should be fixed now. Reopen if not.