I am using a virtual box to build network simulator 3(ns3), Ubuntu version: Linux Server 20.04 LTS
the Linux command that I had executed are
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc g++ python python3 -y
sudo apt-get install python3-setuptools git mercurial -y
sudo apt-get install zip unzip
apt-get install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake -y
sudo apt-get install -y python-gi-cairo
sudo apt-get install -y gir1.2-gtk-3.0
sudo apt-get install -y python-dev
sudo apt-get install -y python3-dev
sudo apt-get install -y qt5-default
sudo apt-get install -y python3-pygraphviz
sudo apt install python3-pip
sudo apt-get install -y graphviz libgraphviz-dev
sudo pip3 install pygraphviz --install-option='--include-path=/usr/include/graphviz' --install-option='--library-path=/usr/lib/graphviz'
Then I use the bake to install the ns3 through following this page: install ns3 with bake
although the "bake.py show" tell me that pygraphvix is Missing, but since it is not an essential dependency, so I ignore it and continue build the ns3
after i successfully built the ns3, I follow the instruction here to execute the "./waf shell" command in the folder "/source/ns-3.29"
then I run the command and get the error:
root#ns3simulator:/home/ns3/source/ns-3.29# python3 examples/wireless/mixed-wired-wireless.py
Traceback (most recent call last):
File "examples/wireless/mixed-wired-wireless.py", line 54, in <module>
import ns.applications
ModuleNotFoundError: No module named 'ns'
Could anyone please help me for this?Thanks in advance.
The problem
"import ns.applications"
ModuleNotFoundError: No module named 'ns'
is because there is a problem with the ns-3 installation and it is not able to do python binding itself and you need to manually configure it.
In my case, I have python 2.7 also installed
Go to
-> cd [PATH-to-your-ns3.29]
-> /usr/bin/python2.7 ./waf configure
it will enable the python binding like this
Waf configuration
after this when you can see the python binding enabled you can run your python script without any error.
Hope it helps !!!
./ns3 configure --enable-python-bindings
Then run the python example. The libraries should get built.
Here
Related
I have VM run on ubuntu 18.04.
On that I installed:
python3.7
confluent-kafka
when run python script, I met this message error:
from .cimpl import (Consumer, #noqa
ModuleNotFoundError: no module named 'confluent_kafka.cimpl'
I've tried to run/install/remove in many ways but this error still occurred.
I don't know why. Please help me.
Install modules confluent_kafka
pip3 install confluent_kafka
or try these steps
sudo apt-get install librdkafka1
sudo apt-get install librdkafka-dev
sudo apt-get install libssl-dev
sudo apt-get install liblz4-dev
sudo apt-get install libsasl2-dev
git clone https://github.com/confluentinc/confluent-kafka-python.git
cd confluent-kafka-python; ./configure ; make ; sudo make install
How Can I upgrade my python3 version from 3.5.2 to 3.7 in AWS EC2 ubuntu instance?
i am getting ImportError: No module named 'secrets' error while trying to runserver using command python3 manage.py runserver. I read somewhere that secrets are not supported in python3 version 3.5, and it works for only higher versions. My python version is 3.5.2. I want to upgrade the version.
I tried sudo apt-get install python3.7, but its not working:
Building dependency tree Reading state information... Done
E: Unable to locate package python3.7
E: Couldn't find any package by glob 'python3.7'
E: Couldn't find any package by regex 'python3.7'
Then I tried sudo update-alternatives --config python3, this is also not working
update-alternatives: error: no alternatives for python3
Try this :
first do this:
sudo apt update
sudo apt install software-properties-common
Then
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.7
reference : https://linuxize.com/post/how-to-install-python-3-8-on-ubuntu-18-04/
Try this:
sudo apt-get update
sudo apt-get install build-essential libpq-dev libssl-dev openssl libffi-dev zlib1g-dev
sudo apt-get install python3-pip python3.7-dev
sudo apt-get install python3.7
In case you don't have the repository and so it fires a not-found package you first have to install this:
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
How do you install PCL Library on Python/Ubuntu 18.04 LTS?
I've tried different ways to do so, without luck.
Trying to import pcl results in:
ImportError: libpcl_keypoints.so.1.7: cannot open shared object file: No such file or directory
Install it as a system-wide library, versus a Python module.
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl
from here
I tried much to solve this issue. The drawback is here:
sudo apt-get install libpcl-dev -y
If you run this, it will install libpcl-dev with a higher version which will be conflicted with that libpcl-dev 1.7 you will install later. Here are some steps to raise the issue:
initially add Ubuntu 16 source list
then run below lines one by one.
sudo apt-get update
pip install python-pcl
sudo apt-get install libpcl-keypoints1.7
sudo apt-get install libpcl-outofcore1.7
sudo apt-get install libpcl-people1.7
sudo apt-get install libpcl-recognition1.7
sudo apt-get install libpcl-registration1.7
sudo apt-get install libpcl-segmentation1.7
sudo apt-get install libpcl-surface1.7
Now, if you get error "libpng12-0", do this:
sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt-get install libpng12-0
sudo apt-get install libpcl-tracking1.7
sudo apt-get install libflann1.8
sudo apt-get install libpcl-visualization1.7
finally,
python
>>> import pcl
Congratulation : PCL is successfully imported
I'm trying to install ns-3 network simulator, and I'm building a simple script that would install all prerequisites on fresh install of latest Ubuntu LTS OS(18.04).
Everything goes smooth but once I try to run any test, I get following error:
Traceback (most recent call last):
File "./source/ns-3.29/test.py", line 1942, in <module>
sys.exit(main(sys.argv))
File "./source/ns-3.29/test.py", line 1939, in main
return run_tests()
File "./source/ns-3.29/test.py", line 1010, in run_tests
read_waf_config() File "./source/ns-3.29/test.py", line 579, in read_waf_config
for line in open(".lock-waf_" + sys.platform + "_build", "rt"):
IOError: [Errno 2] No such file or directory: '.lock-waf_linux2_build'
This also happens when I try simply:
./waf --help
Script doesn't do anything spectacular, but here it is just in case. It has to be invoked using sudo
#!/bin/bash
echo "Installing..."
# basic OS update
apt update
apt upgrade -y
apt dist-upgrade -y
apt autoremove -y
apt autoclean -y
# install prerequisites
apt install git -y
apt install gcc -y
apt install g++ -y
apt install mercurial -y
apt install cvs -y
apt install bzr -y
apt install make -y
apt install cmake -y
apt install qt5-default -y
apt install qtcreator -y
apt install python-gi-cairo -y
apt install gir1.2-goocanvas-2.0 -y
apt install python-pygraphviz -y
apt install python-dev -y
apt install python-setuptools -y
## acquire Bake
git clone https://gitlab.com/nsnam/bake
# add Bake to PATH
export BAKE_HOME=`pwd`/bake
export PATH=$PATH:$BAKE_HOME
export PYTHONPATH=$PYTHONPATH:$BAKE_HOME
# check if all valid
bake.py check
# configure Bake for ns-3
bake.py configure -e ns-3.29
bake.py show
# download and build ns-3
bake.py download
cd ./source/ns-3.29/ && ./waf configure && cd ../../
bake.py build
#instead of 3 lines above this comment there was previously just "bake.py deploy"
./source/ns-3.29/test.py #this causes an error
echo "Finished Install!"
./waf configure gives following output:
output (pastebin)
ns-3 bundled waf in the distribution. When you build from scratch, the first thing you want to do is to run ./waf configure so that you have the waf module unpacked to a directory named like waf3-2.0.15-ff6573b86ad5ff5d449c8852ad58b8bc. The missing Scripting is supposed to be the file waf3-2.0.15-ff6573b86ad5ff5d449c8852ad58b8bc/waflib/Scripting.py
I don't know what went wrong as you didn't provide enough clue. But check if you have the directory I mentioned above in the ns3 directory, if so, delete it then run ./waf configure again.
try to run the same command using sudo.
It worked for me.
I wanna set up scrapy cluster follow this link scrapy-cluster,Everything is ok before I run this command:
pip install -r requirements.txt
The requirements.txt looks like:
cffi==1.2.1
characteristic==14.3.0
ConcurrentLogHandler>=0.9.1
cryptography==0.9.1
...
I guess the above command means to install packages in requirements.txt.But I don't want it to specify the version,So I change it to this:
cat requirements.txt | while read line; do pip install ${line%%[>=]*} --user;done
When install cryptography,it gives me the error:
build/temp.linux-x86_64-2.7/_openssl.c:12:24:fatal error:pyconfig.h:No such file or directory
#include <pyconfig.h>
I don't know how to solved this , I have tried a lot of methods ,but failed. my system is centos 7, and the version of python is 2.7.5(default).
Besides, Is there any other scrapy frame which is appliable for a large number of urls . Thanks in advance
For Ubuntu, python2
apt-get install python-dev
For Ubuntu, python3
apt-get install python3-dev
I have solved it by myself. for the default python of centos, there is only a file named pyconfg-64.h in usr/include/python2.7/,So run the command
yum install python-devel
Then it works.
for python3.6,
apt-get install python3.6-dev
and
apt-get install libssl-dev libffi-dev
i use python 2 on ubuntu and got the same problem when installing cryptography.
after i run this command
apt-get install python-dev libssl-dev libffi-dev
then it works.
For Python 3.7 on Debian, the following works for me.
apt-get install python3.7-dev
and
apt-get install libssl-dev
You may also need:
apt-get install libffi-dev
On a Debian based distro (AntiX distro), together with apt-get install python3-dev, I also installed rust, to complete successfully the pip3 install cryptography command. So, I gave:
$ sudo apt-get install build-essential curl python3-dev libssl-dev libffi-dev
$ sudo curl https://sh.rustup.rs -sSf | sh
When prompted (Figure 1), type 1 and hit Enter on your keyboard.
Once it completes, you have to give following commands:
$ source $HOME/.cargo/env
$ source ~/.profile
$ pip3 install cryptography