How to fix netifaces module installation for python2.7? - python

Environment : Kali Linux 2
I started reading this book "Python network programming cookbook" and the writers listed few modules I am gonna need during the book i was able to install all of them except #netifaces, I tried both the "pip install netifaces" and "python setup.py install" methods but both made appear this message:
x86_64-linux-gnu-gcc: error trying to exec 'cc1': execvp: No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-lsf_5N/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-TsHwUh-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-lsf_5N/netifaces
Storing debug log for failure in /root/.pip/pip.log
I tried to install python-dev and all the libraries I could find in previous asked questions here but nothing made it happen
Thank you all for your help

It looks like you are missing gcc, which is needed to compile netifaces.
I've never used Kali Linux before but you should have apt so, you can try: sudo apt-get install gcc to install the missing package.
Hopefully this solves your problem.

Related

Error installing Python package: make utility is missing from PATH

I'm attempting to install pynacl on a new Windows machine with Python. Ran into the following error:
raise Exception("ERROR: The 'make' utility is missing from PATH")
Exception: ERROR: The 'make' utility is missing from PATH
----------------------------------------
Command ""c:\users\paul miller\appdata\local\programs\python\python37\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\PAULMI~1\\AppData\\Local\\Temp\\pip-install-wxwyakn7\\pynacl\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record C:\Users\PAULMI~1\AppData\Local\Temp\pip-record-syh9a1l_\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in C:\Users\PAULMI~1\AppData\Local\Temp\pip-install-wxwyakn7\pynacl\
In an attempt to resolve the exception, I installed GnuWin and added the path to my user and system PATH variables.
I opened a new command window and verified that "make" executed. However, rerunning the install attempt with the following command resulted in the same exception:
pip3 install pynacl
What should I try next?
EDIT 1: added screenshot to show Make working
EDIT 2: Tried with easy_install as well, still getting the make error
So, this was an idiotic mistake on my part. Turns out I had installed a beta version of Python... Python 3.7.0b4, to be specific.
Doom on me.
I removed the beta and installed 3.6.4 and everything worked fine.
Oops.

Error while installing notebook using pip

note: I am on linux(ubuntu,mint)
I am trying to install jupyter. But after some searching I realised that the error I have when trying to install jupyter is due to notebook.
So here is the error I have when trying to install notebook using sudo pip install notebook.
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-EKmj0F/scandir/setup.py';
f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();
exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-OB5xPr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-EKmj0F/scandir/
If you want here is the whole output of pip install notebook.
Thank for answers in advance.
This is the relevant part of the error message:
_scandir.c:14:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
You need the Python headers:
sudo apt-get install python-dev
Your installation process tries to compile an extension with gcc and you seem to be missing the necessary decencies.

How to install pymssql on MacOS Sierra

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-J1I0ox/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qmtdBW-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-J1I0ox/pymssql/
I am having the same error as displayed here . I followed the instructions on that page by trying brew install freetds followed by sudo -H pip install pymssql.
That generates this error code:
_mssql.c:18814:15: error: use of undeclared identifier 'DBVERSION_80'
__pyx_r = DBVERSION_80;
^
4 warnings and 1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-J1I0ox/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qmtdBW-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-J1I0ox/pymssql/
Searching this error brought me to this page. I followed the solution posted there by trying both brew unlink freetds; brew install homebrew/versions/freetds091 and brew uninstall freetds; brew install homebrew/versions/freetds091 which generates a different error when trying sudo -H pip install pymssql:
_mssql.c:266:10: fatal error: 'sqlfront.h' file not found
#include "sqlfront.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-build-97A9sQ/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-0nUZo4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-build-97A9sQ/pymssql/
So then I gave up and tried to install pyodbc, but I still get similar errors: src/pyodbc.h:56:10: fatal error: 'sql.h' file not found
#include sql.h
Any help with this would be great.
This link ended up solving my problem. For anyone else having these issues, this sequence of commands worked for me.
brew uninstall --force freetds
brew install freetds#0.91
brew link --force freetds#0.91
pip install pymssql
As of Feb 2021
I can no longer install freetds#0.91 as homebrew does not have it available. The current version of freetds is 1.2.18 and brew link --force freetds doesn't seem to change anything.
The root issue 'sqlfront.h' file not found is due to the freetds files not linking properly during installation. We can fix this by doing
export LDFLAGS="-L/opt/homebrew/opt/freetds/lib"
export CPPFLAGS="-I/opt/homebrew/opt/freetds/include"
pip install pymssql
Where /opt/homebrew/opt/freetds is where homebrew installed freetds on your system (I am on Apple Silicon) and may be different for you. If you are on Intel your's might look something like /usr/local/opt/freetds.
To find exactly where homebrew installed freetds (or any program for that matter) on your system, you can do
brew --prefix freetds
This should return something like /opt/homebrew/opt/freetds or /opt/homebrew/opt/freetds#1.2.18. You can ignore any version numbers and append /lib and /include to get the paths you need.
This is a handy trick to keep in mind as it is applicable to lots of other install issues with dependencies installed via homebrew.

Can't install NetworKit

I have been trying to figure out what the problem was for installing this module for a while and I'm stuck. The only related link I could find is here. I type in the command sudo -E pip3 install networkit into the terminal and here is what I am getting.
g++: error: unrecognized command line option '-Qunused-arguments'
g++: error: unrecognized command line option '-Qunused-arguments'
error: command 'g++' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -c "import setuptools, tokenize;__file__='/private/var/folders/9n/zhnv69nd7sv9fj9gsg64c1p00000gp/T/pip-build-l15ye4xm/networkit/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9n/zhnv69nd7sv9fj9gsg64c1p00000gp/T/pip-25ou5_op-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/9n/zhnv69nd7sv9fj9gsg64c1p00000gp/T/pip-build-l15ye4xm/networkit
I was able to install all the python packages mentioned here using pip. I have python 3.5, installed gcc5 using macports, currently use Cython version 0.23.4, and installed OpenMP through Homebrew. I was able to find answers to most of the problems I ran into, but I can't seem to find one for this.
Edit: which g++ produces /opt/local/bin/g++ and echo ${CXX} produces a blank line

Can't pip install anything requiring C compilation on OSX 10.10 with homebrew python

When I try to pip install things that involve C compilation (Pillow, specifically) I get an odd error:
clang: error: no such file or directory: 'Python.framework/Versions/2.7/Python'
error: command 'clang' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/xt/f2d8vp4j65j2rt71pns6trjw0000gn/T/pip_build_jakob/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/xt/f2d8vp4j65j2rt71pns6trjw0000gn/T/pip-LnL0hW-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/xt/f2d8vp4j65j2rt71pns6trjw0000gn/T/pip_build_jakob/Pillow
I posted my pip.log for this installation.
I think this problem is due to a combination of OSX 10.10 Yosemite and Homebrew python. Have you experienced this before? ideas on how to fix it?
You need to install XCode in order to be be able to compile on OS X.

Categories

Resources