Failed to re-build pycurl with OpenSSL - python

I'm trying to rebuild pycurl with OpenSSL because of this bug.
I use this example:
sudo apt-get install build-essential fakeroot dpkg-dev
mkdir ~/python-pycurl-openssl
cd ~/python-pycurl-openssl
sudo apt-get source python-pycurl
sudo apt-get build-dep python-pycurl
sudo apt-get install libcurl4-openssl-dev
sudo dpkg-source -x pycurl_7.19.3-0ubuntu3.dsc
cd pycurl-7.19.3
edit debian/control file and replace all instances of 'libcurl4-gnutls-dev' with 'libcurl4-openssl-dev' (7 changes)
sudo PYCURL_SSL_LIBRARY=openssl dpkg-buildpackage -rfakeroot -b
sudo dpkg -i ../python-pycurl_7.19.3-0ubuntu3_amd64.deb
But after all I'm still stuck with GnuTLS build of pycurl.
>>> pycurl.version
'PycURL/7.19.5.1 libcurl/7.35.0 GnuTLS/2.12.23 zlib/1.2.8 libidn/1.28 librtmp/2.3'
Operation log (there are some error's tracebacks): http://pastebin.com/6hUEUGar
I use:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
What am I doing wrong?
I could solve the problem using pip:
sudo pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
sudo pip install pycurl --upgrade
Now:
>>> pycurl.version
'PycURL/7.19.5.1 libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3'
But I'm not sure It's right. Why are there two package in the system?
Or it's ok and python is just linked to one of them?

Related

Why my pycurl is not compiled against Openssl?

I'm trying to run on kali linux 2020 wfuzz, but i got this error
/usr/local/lib/python3.9/dist-packages/wfuzz-3.1.0-py3.9.egg/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
I tried this too but it doesn't work :
sudo apt-get install build-essential fakeroot dpkg-dev
mkdir ~/python-pycurl-openssl
cd ~/python-pycurl-openssl
sudo apt-get source python-pycurl
sudo apt-get build-dep python-pycurl -y
Any idea?

How Can I upgrade my python3 version from 3.5.2 to 3.7 in AWS EC2 ubuntu instance?

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

ns3, Python3 has no module named 'ns'

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

Install PyQt5 on Raspberry for Python3.6

Since I found no answer for my question, neither in older posts nor in other forums, I want to ask the stackoverflow community for advice.
I am using a raspberry pi 3B+, version 9.4 (lite) with kernel version 4.14.71-v7.
I use python3.6. I installed it as follows:
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
sudo tar xzf Python-3.6.0.tgz
sudo -s
cd Python-3.6.0
bash configure
make altinstall
exit
Installation was without any trouble and everything works perfectly.
Now I wanted to install the PyQt5 modul for python3.6. I usually use
sudo python3.6 -m pip install ...
for installing a modul for python3.6. Trying
sudo python3.6 -m pip install pyqt5
gave me the error message
Could not find a version that satisfies the requirement PyQt5 (from versions: )
No matching distribution found for PyQt5
So I tried
sudo apt-get update
sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools
But it installed PyQt5 for python3.5 (which is preinstalled) on the raspberry.
So does anybody know how to use or install PyQt5 for the subsequently installed
python3.6?
Edit 08.03.2019:
Thanks FlyingTeller. I started to build from source. I followed the steps from
your link.
sudo apt-get update
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
sudo tar xzf sip-4.19.14.tar.gz
cd sip-4.19.14
sudo -s
python3.6 configure.py --sip-module=PyQt5.sip
make
make install
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gz
sudo tar xzf PyQt5_gpl-5.12.tar.gz
cd PyQt5_gpl-5.12
python3.6 configure.py
Then I received the following error
Error: Use the --qmake argument to explicitly specify a working Qt qmake.
I think I am on the right way, but I do not understand what qmake is or what it
means.
Edit 10.03.2019:
I could solve the last error message. I installed
sudo apt-get install qt5-default
Then I did the same procedure as already mentioned. Now I get the error
fatal error: sip.h: File or directory not found
#include <sip.h>
PyQt5 config.py is in: /usr/src/PyQt5_gpl-5.12
SIP sip.h is in: /usr/src/sip-4.19.14
Anybody an idea? Thanks guys.
Today I found the solution. The steps below worked for me, without any error. The whole process took almost two hours.
sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install sip-dev
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
sudo tar xzf sip-4.19.14.tar.gz
cd sip-4.19.14
sudo python3.6 configure.py --sip-module PyQt5.sip
sudo make
sudo make install
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gz
sudo tar xzf PyQt5_gpl-5.12.tar.gz
cd PyQt5_gpl-5.12
sudo python3.6 configure.py
sudo make
sudo make install
Seems like they moved some things around. This seems to work, as far as getting things, and compiling them. It takes a long time to build.
For the associated designer, look at:
QtDesigner for Raspberry Pi
sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install sip-dev
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.23/sip-4.19.23.tar.gz
sudo tar xzf sip-4.19.23.tar.gz
cd sip-4.19.23
sudo python3 configure.py --sip-module PyQt5.sip
sudo make
sudo make install
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.13.2/PyQt5-5.13.2.tar.gz
sudo tar xzf PyQt5-5.13.2.tar.gz
cd PyQt5-5.13.2
sudo python3 configure.py
sudo make
sudo make install
In my case it helped to update pip from verion 18 to the newest, in my case 20.2 (python -m pip install --upgrade pip) and then do a pip install PyQt5.
The instructions used in the accepted answer did not work for me. I think it's simply because they are outdated. I wanted to post the list of commands that did work for me. I'm running a Pi 400 with the latest version of Raspbian as of 12/20/2020. I used the default python3 rather than python3.6.
Here is the modified list of commands that worked for me:
sudo apt-get install qt5-default
sudo apt-get install sip-dev
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-5.5.1.dev2011271026.tar.gz
sudo tar xzf sip-5.5.1.dev2011271026.tar.gz
cd sip-5.5.1.dev2011271026
sudo python3 setup.py build
sudo python3 setup.py install
sudo wget https://files.pythonhosted.org/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz
sudo tar xzf PyQt5-5.15.2.tar.gz
cd PyQt5-5.15.2
sudo python3 configure.py
sudo make
sudo make install
Can't comment due to reputation but I would add to Christ Troutner's useful updated answer, that in case users get a No module named 'PyQt5.sip' error, try --sip-module PyQt5.sip during configure, per the docs:
Note
When building PyQt5 v5.11 or later you must configure SIP to create a
private copy of the sip module using a command line similar to the
following:
python configure.py --sip-module PyQt5.sip
If you already have SIP installed and you just want to build and
install the private copy of the module then add the --no-tools option.
The accepted answers did not work for me, below is the code that worked for me.
sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install qtcreator
This code not only installs Qtcreator but also installs Qt5 Assistant, Qt5 Designer, and Qt5 Linguist

pyconfig.h missing during "pip install cryptography"

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

Categories