Giter Site home page Giter Site logo

Comments (6)

antoninbas avatar antoninbas commented on August 14, 2024

It is an issue with your Thrift installation. There is a discrepancy between your Thrift compiler version and your Thrift python package.
You can check your Thrift compiler version with thrift -v and the python package version with pip show thrift.
Officially we only support versions 0.9.2 and 0.9.3. But feel free to try using 1.0.0 as well. The most important things is that the versions match.

from p4factory.

chenxiang2019 avatar chenxiang2019 commented on August 14, 2024

@antoninbas Thank you for answering my questions again. It's very kind of you!

By checking the version of thrift and thrift python packet, I found the version didn't match: the Thrift compiler version is 1.0.0-dev but the version of Thrift python packet is 0.9.3. That's because I forgot having installed thrift 0.9.3 before, and I reinstalled it by cloning and following the P4Lang/Thrift.

Then I tried to fix the problem, I cd to the directory /usr/local/bin and renamed the executable file thrift:

mv thrift thrift1

and then installed the thrift 0.9.3

wget http://mirrors.hust.edu.cn/apache/thrift/0.9.3/thrift-0.9.3.tar.gz
tar -zxvf thrift-0.9.3.tar.gz
cd thrift-0.9.3
./configure
make
make install

Then the versions matched:

root@ubuntu:/home/wasdns/p4factory/targets/simple_router# thrift -version
Thrift version 0.9.3
root@ubuntu:/home/wasdns/p4factory/targets/simple_router# pip show thrift
Name: thrift
Version: 0.9.3
Summary: Python bindings for the Apache Thrift RPC system
Home-page: http://thrift.apache.org
Author: Thrift Developers
Author-email: [email protected]
License: Apache License 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: 

cd to the simple_router directory and tried again, however, it still failed.

root@ubuntu:/home/wasdns/p4factory/targets/simple_router# ./run_add_demo_entries.bash 
ImportError: cannot import name TFrozenDict
ImportError: cannot import name TFrozenDict
ImportError: cannot import name TFrozenDict
ImportError: cannot import name TFrozenDict
ImportError: cannot import name TFrozenDict
ImportError: cannot import name TFrozenDict

Is it something wrong with the dependencies? I'm afraid of deleting the old version of Thrift because it brought me more questions before.

Could you show me how to do with it? Iā€™m truly grateful for your help.

from p4factory.

antoninbas avatar antoninbas commented on August 14, 2024

The thrift compiler takes a thrift IDL file as an input and produces -in our case- C++ source (for the server) and Python code (for the client). If you rollback the thrift compiler to a previous version, you still need to run the new compiler again otherwise the source files won't get re-generated and you will get the same exact error. In other words, you should probably do a make clean and build again.
Also the way you "removed" the existing thrift installation seems a little hacky to me. You moved the executable but are you sure that the right shared library are being picked up? You should probably remove everything installed by thrift under <prefix>/bin and <prefix>/lib and re-install. But then again maybe you won't need to do that.
Finally you seem to be using the first version of the behavioral-model (bmv1 or p4c-behavioral), which is pretty much deprecated at this stage. There is a similar mininet demo which uses the new behavioral-model (bmv2) and does not require p4factory: https://github.com/p4lang/behavioral-model#integrating-with-mininet.

from p4factory.

chenxiang2019 avatar chenxiang2019 commented on August 14, 2024

@antoninbas

Thanks a lot. It's invaluable experience in my way to continue. The reason why I took the method that I mentioned above is because I think the libraries of Thrift 0.9.3 will take place of old ones when I make install it. With your guide, I learned a lot of important experiences of doing experiment myself. Thanks for your kindness.

from p4factory.

baganal avatar baganal commented on August 14, 2024

Hi, @Wasdns

Did you solve this issue? I have a thrift compiler version of 0.11.0 and pip show thrift gives me 0.9.2. I am not sure how will I change the thrift compiler version to 0.9.2 or uninstall it.

from p4factory.

antoninbas avatar antoninbas commented on August 14, 2024

@baganal this repo is no longer maintained (see README)

from p4factory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.