Failure to build wheel / "Error: INCLUDE Environment Variable is empty" - python

I am using Python 2.7.11 and am trying to pip install modules however a few of them are failing. The message I get is "Failure to build wheel for 'X'" and "Error: INCLUDE Environment Variable is empty".
I tried to install Scrapy, LXML and Twisted and those failed. Some other random modules I tried installed fine.
I have installed pyOpenSSL, added python27 and python27/scripts to environment.
Thanks,

I tried both the solutions offered, none worked.
I installed Microsoft Visual C++ Compiler for Python 2.7, download it here. Then run:
pip install scrapy
That worked for me

A quick solution is to install the pre-compiled version of lxml. You can find it here. If you use the .exe you can point it directly to your python root folder.
After that:
close and re-open cmd
pip install your_package (make sure cmd is in the correct directory)
enjoy having no frustrating lxml errors!
Hope this helped.

Use a pre built library from this link if you are on windows:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
Choose the relevant library given python version and desktop config. For example
I want to install apell in python 3.6 and winamd64 then download this:
aspell_python-1.15-cp36-cp36m-win_amd64.whl
Now go to your console and type
pip install path-to-.whl
and that's it.

Related

Installing python packages on a Chromebook in Visual Studio

I'm trying to install a python package (specifically pandas) into Visual Studio code on a chromebook's linux virtual machine. I've tried many different things but none of them seem to work: trying to use pip install pandas results in bash: pip: command not found. I have no idea where the actual python interpreter is located, so I can't go to the source. I thought it was that I wasn't using the correct terminal, but the only other option is JavaScript Debug Terminal. What am I doing wrong? Is it even possible?
Pip is a python package management tool, which provides the functions of finding, downloading, installing and uninstalling Python packages. However, this tool is not included in the system and needs to be installed manually. Here is the official website of PIP, which contains installation instructions.

How to install nltk [duplicate]

I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
The accepted answer is outdated. So first, pip is preferred over easy_install, (Why use pip over easy_install?). Then follow these steps to install pip on Windows, it's quite easy.
Install setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
Install pip:
curl https://bootstrap.pypa.io/get-pip.py | python
Optionally, you can add the path to your environment so that you can use pip anywhere. It's somewhere like C:\Python33\Scripts.
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
pip.exe install mechanize
This is a good tutorial on how to get easy_install on windows. The short answer: add C:\Python26\Scripts (or whatever python you have installed) to your PATH.
You don't need the executable for setuptools.
You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
python -m pip install [package-name]
As I wrote elsewhere
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
Firstly, you'll need to add python installation to your PATH variable. This should help.
You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
Run the command python setup.py install
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
Upgrade the pip via command prompt ( Python Directory )
D:\Python 3.7.2>python -m pip install --upgrade pip
Now you can install the required Module
D:\Python 3.7.2>python -m pip install <<yourModuleName>>
pip is the package installer for python, update it first, then download what you need
python -m pip install --upgrade pip
Then:
python -m pip install <package_name>
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
PS D:\simcut> C:\Python27\Scripts\pip.exe install networkx
Collecting networkx
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS reques
t has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer ve
rsion of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SS
LContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.
readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 664kB/s
Collecting decorator>=3.4.0 (from networkx)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Installing collected packages: decorator, networkx
Successfully installed decorator-4.0.11 networkx-1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object i
s not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplat
formwarning.
InsecurePlatformWarning
Or just put the directory to your pip executable in your system path.
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
You can type directly into the search menu pip install mechanize, select command and it will install:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.

getting python pyobcd installed

I'm a little lost on how to get pyodbc installed in my computer.
I have python 3.6.1
The link
http://support.esri.com/en/technical-article/000011656
pointed me to another link
https://github.com/mkleehammer/pyodbc
Which is vague.
I'm used to downloading and running an exe for install.
This link is unclear and says all I have to do is:
"pip install pyodbc"
What exactly do I need to do to get this working?
Since you have not mentioned which OS you are using,
I will assume that you are on windows (as you have mentioned that you are used to install using .exe).
Firstly you need to know what a pip is:
pip is basically a package manager for python packages used to install 3 rd party packages which do not bundle along with the python distribution.
On linux pip comes pre installed also if you are using python version 3.4 onwards or python 2.7.9 you will be having pip pre installed on your system.
All you have to do it to open the command prompt issue the command
pip install package-name(pyobdc here)
it will do the job.
If you do not find pip in your distribution you can refer this link
How do I install pip on Windows?
open cmd in your computer and type
pip install pyobdc
Hello there and welcome to python programming. Basically python comes with its package installer so either you can go to any interpreter that you are using and type pip install pyobdc or use the command prompt in windows and type in pip install pyobdc. This would install your module and just remember to put import pyobdc at the top of the code if you want to use this package. Further information can be found on here

How to install Yaml and some other Python modules on OS X sierra? [duplicate]

I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
The accepted answer is outdated. So first, pip is preferred over easy_install, (Why use pip over easy_install?). Then follow these steps to install pip on Windows, it's quite easy.
Install setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
Install pip:
curl https://bootstrap.pypa.io/get-pip.py | python
Optionally, you can add the path to your environment so that you can use pip anywhere. It's somewhere like C:\Python33\Scripts.
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
pip.exe install mechanize
This is a good tutorial on how to get easy_install on windows. The short answer: add C:\Python26\Scripts (or whatever python you have installed) to your PATH.
You don't need the executable for setuptools.
You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
python -m pip install [package-name]
As I wrote elsewhere
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
Firstly, you'll need to add python installation to your PATH variable. This should help.
You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
Run the command python setup.py install
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
Upgrade the pip via command prompt ( Python Directory )
D:\Python 3.7.2>python -m pip install --upgrade pip
Now you can install the required Module
D:\Python 3.7.2>python -m pip install <<yourModuleName>>
pip is the package installer for python, update it first, then download what you need
python -m pip install --upgrade pip
Then:
python -m pip install <package_name>
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
PS D:\simcut> C:\Python27\Scripts\pip.exe install networkx
Collecting networkx
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS reques
t has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer ve
rsion of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SS
LContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.
readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 664kB/s
Collecting decorator>=3.4.0 (from networkx)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Installing collected packages: decorator, networkx
Successfully installed decorator-4.0.11 networkx-1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object i
s not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplat
formwarning.
InsecurePlatformWarning
Or just put the directory to your pip executable in your system path.
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
You can type directly into the search menu pip install mechanize, select command and it will install:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.

Python 2.7.11 pip not installed

I have Python 2.7.11 installed on my machine which to my understanding should come with pip, however when I check the C:\Python27\Tools\Scripts\ directory there is no pip.exe present.
I have tried completely removing and reinstalling Python 2.7.11 without success. Running the installer pip is set to be installed, but after the install pip is nowhere to be found.
I also have Python 3.4 installed which has pip as expected. Any thoughts?
I encountered the same problem - pip not installed - with python-2.7.16, Win10, installing for 'all users'. It was resolved when I allowed the MSI installer to target the default location (C:\Python27) rather than changing it to under Program Files (x86). I've no clue why this changed anything.
python2.7.11 should install pip into c:\python27\scripts, you can take a look here
I used https://pip.pypa.io/en/stable/installing/ to make it install. Odd that an outside body has to make a tool to get pip to install. There is no mention of pip.pypa.io on the Python web site.
Although I got error messages, it did install, so check carefully.
You also may see a message suggesting that you upgrade to pip 9.0 with the command 'pip install --upgrade.' I highly recommend that.
Also, make sure you are in the directory where pip.exe is located when you run the commands. They don't tell you that, because they assume you know that, but we're not all geeks.
For people who are running into this issue, I have a Windows 10 x86 dev box that I use for exploit development, Python 2.7 was installed due to Immunity Debugger, this install did not include the new SSL package and did not include "pip".
There was no "C:\Python27\Scripts" folder which included pip. I did have a "C:\Python27\Tools\Scripts" folder which did not have pip installed.
I tired to install pip as suggested but did not work. Best way is to uninstall Python and install newest version, currently mine is 2.7.15 which came with pip as an option. This is what solved my issue, any older version of Python will need upgraded to support the SSL packages. You will receive the same errors when you try to install pip on an older version.
If you have reinstalled Python which included the SSL package and it still does not have pip, trying installing pip this way:
1. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
2. python get-pip.py
https://pip.pypa.io/en/stable/installing/
This should work if you have a newer version of Python.
Once you have installed pip or newer version of python, go to "C:\Python27\Scripts" and you should see pip.exe.
I have installed "python-2.7.16" in my windows 10 PC. PIP is installed under "C:\Python27\Scripts". One can add the "C:\Python27\Scripts" path to environment variable and then access pip command from command prompt.
To add the path in environment variable:
Control Panel\System and Security\System --> Advanced System Settings --> Advanced --> enviroment variables --> under system variable --> Path(variable name)
Had the issue where no matter which version of python 2.7 I installed on windows 10 there was no pip.exe generated in the "Scripts" folder.
I solved it by ensuring that that MSI Installer file had Admin privileges before installing
if pip is not installed you can use easy_install.exe to install pip and other modules
you can find easy install in
python -m easy_install pip
I had the same issue:
Installed Python 27
Tried to use pip, but failed with unrecognized command error
Checked installation: no "C:\Python27\Scripts", only "C:\Python27\Tools\Scripts"
This issue happens only on some versions of Windows.
HOW TO FIX IT:
Uninstall Python 27
Reinstall Python 27, but unselect "pip" feature
Check installation: no "C:\Python27\Scripts" as expected
Start the installer again and use "Change Python"
Set "pip" and "Add Python.exe to Path" features to be installed
Check installation: "C:\Python27\Scripts" is now correctly present
So for some unknown reason, pip is not correctly installed on some versions of Windows if it is installed during default Python 27 setup. To fix this issue, pip must be installed afterwards using the "Change Python" setup.
I meet the same issue when install Python 2.7.9. The installer does not come with pip.
Solution:
Install newer python2 x86 version: https://www.python.org/downloads/release/python-2718/
Then pip is located at C:\Python27\Scripts\pip.exe
It happens on windows as you should have admin rights to install anything on disk C.
I have the same issue Scripts folder was not installed. I would sugest to instal it on disk D.

Categories