Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems encountered when using the p4run command #49

Open
214774894 opened this issue Feb 15, 2023 · 5 comments
Open

Problems encountered when using the p4run command #49

214774894 opened this issue Feb 15, 2023 · 5 comments

Comments

@214774894
Copy link

`root@ubuntu:/home/p4/program/idtra_v0.1# p4run
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 584, in _build_master
ws.require(requires)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (protobuf 3.18.3 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5'), {'googleapis-common-protos'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/p4run", line 6, in
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3254, in
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3237, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3266, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 586, in _build_master
return cls._build_from_requirements(requires)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 599, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (protobuf 3.18.3 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5'), {'googleapis-common-protos'})`

When I use p4run to execute my p4 program, the system gives the above error and my protoc version is 3.6.1. can I find an older version of p4-utils to use the p4run command? Will it affect my p4 environment if I use the upgrade protobuf approach?

@Master-COLLiDER
Copy link

hello @214774894 , I have created a new VM image with P4 Utils + SDN ~12GB here is the link to download it
User name: p4
password : p4

@Master-COLLiDER
Copy link

`root@ubuntu:/home/p4/program/idtra_v0.1# p4run Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 584, in _build_master ws.require(requires) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 901, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 792, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.ContextualVersionConflict: (protobuf 3.18.3 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5'), {'googleapis-common-protos'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/p4run", line 6, in from pkg_resources import load_entry_point File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3254, in def _initialize_master_working_set(): File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3237, in _call_aside f(*args, **kwargs) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3266, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 586, in _build_master return cls._build_from_requirements(requires) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 599, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 792, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.ContextualVersionConflict: (protobuf 3.18.3 (/usr/local/lib/python3.8/dist-packages), Requirement.parse('protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5'), {'googleapis-common-protos'})`

When I use p4run to execute my p4 program, the system gives the above error and my protoc version is 3.6.1. can I find an older version of p4-utils to use the p4run command? Will it affect my p4 environment if I use the upgrade protobuf approach?

Use ubuntu 18

@Tyler-ytr
Copy link

When I use ubuntu20, I have the same problem while my protubuf version is 3.18.3.

@WigginsLi
Copy link

I solve this by modifying googleapis-common-protos == 1.52 in p4-utils/setup.py. The file looks like:

#!/usr/bin/env python3

"Setuptools params"

from setuptools import setup, find_packages

VERSION = '0.2'

modname = distname = 'p4utils'

def readme():

    with open('README.md','r') as f:
        return f.read()

setup(
    name=distname,
    version=VERSION,
    description='P4 language and bmv2 model utilities',
    author='Edgar Costa Molero',
    author_email='cedgar@ethz.ch',
    packages=find_packages(),
    long_description=readme(),
    entry_points={'console_scripts': ['p4run = p4utils.p4run:main']},
    include_package_data = True,
    classifiers=[
        "License :: OSI Approved :: BSD License",
        "Programming Language :: Python 3",
        "Development Status :: 2 - Pre-Alpha",
        "Intended Audience :: Developers",
        "Topic :: System :: Networking",
        ],
    keywords='networking p4 mininet',
    license='GPLv2',
    install_requires=[
        'googleapis-common-protos == 1.52',
        'grpcio >= 1.17.2',
        'ipaddr',
        'ipaddress',
        'networkx',
        'p4runtime',
        'protobuf == 3.18.3',
        'psutil',
        'scapy == 2.4.4',
        'setuptools',
    ],
    extras_require={}
)

And then try sudo ./install.sh again to install p4-utils.

@Dmmmmmy
Copy link

Dmmmmmy commented Jan 19, 2024

I solve this by modifying googleapis-common-protos == 1.52 in p4-utils/setup.py. The file looks like:

#!/usr/bin/env python3

"Setuptools params"

from setuptools import setup, find_packages

VERSION = '0.2'

modname = distname = 'p4utils'

def readme():

    with open('README.md','r') as f:
        return f.read()

setup(
    name=distname,
    version=VERSION,
    description='P4 language and bmv2 model utilities',
    author='Edgar Costa Molero',
    author_email='cedgar@ethz.ch',
    packages=find_packages(),
    long_description=readme(),
    entry_points={'console_scripts': ['p4run = p4utils.p4run:main']},
    include_package_data = True,
    classifiers=[
        "License :: OSI Approved :: BSD License",
        "Programming Language :: Python 3",
        "Development Status :: 2 - Pre-Alpha",
        "Intended Audience :: Developers",
        "Topic :: System :: Networking",
        ],
    keywords='networking p4 mininet',
    license='GPLv2',
    install_requires=[
        'googleapis-common-protos == 1.52',
        'grpcio >= 1.17.2',
        'ipaddr',
        'ipaddress',
        'networkx',
        'p4runtime',
        'protobuf == 3.18.3',
        'psutil',
        'scapy == 2.4.4',
        'setuptools',
    ],
    extras_require={}
)

And then try sudo ./install.sh again to install p4-utils.

Based on the answer I have sovled the problem,thank you. My unbuntu version is 20.04,protobuf is 3.20.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants