Python: KenLM installation error - python-2.7

I am installing KenLM on Python2.7 on Windows 7 64 bit with the following command:
pip install https://github.com/kpu/kenlm/archive/master.zip
Error message:
C:\Python27\Scripts>pip install https://github.com/kpu/kenlm/archive/master.zip
Collecting https://github.com/kpu/kenlm/archive/master.zip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x000000000373C2B0>, 'Connection to gith
ub.com timed out. (connect timeout=15)')': /kpu/kenlm/archive/master.zip
Downloading https://github.com/kpu/kenlm/archive/master.zip (518kB)
100% |################################| 522kB 7.3kB/s
Installing collected packages: kenlm
Running setup.py install for kenlm ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\phyukh~1\\appdata\\local\\temp\\pip-gny9pz-build
\\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\phyukh~1\appdata\local\temp\pip-jpsst8-record\install-record.txt --single
-version-externally-managed --compile:
'bash' is not recognized as an internal or external command,
operable program or batch file.
'bash' is not recognized as an internal or external command,
operable program or batch file.
'bash' is not recognized as an internal or external command,
operable program or batch file.
running install
running build
running build_ext
building 'kenlm' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\util
creating build\temp.win-amd64-2.7\Release\lm
creating build\temp.win-amd64-2.7\Release\util\double-conversion
creating build\temp.win-amd64-2.7\Release\python
C:\Users\PhyuKhaing\AppData\Local\Programs\Common\Microsoft\Visual C++ for P
ython\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. -Ic:\pyth
on27\include -Ic:\python27\PC /Tputil\bit_packing.cc /Fobuild\temp.win-amd64-2.7
\Release\util\bit_packing.obj -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
bit_packing.cc
.\util/bit_packing.hh(30) : fatal error C1083: Cannot open include file: 'st
dint.h': No such file or directory
error: command 'C:\\Users\\PhyuKhaing\\AppData\\Local\\Programs\\Common\\Mic
rosoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit sta
tus 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\phyukh~1\\appdata\\local\\temp\\pip-gny9pz-build\\setup.py';f=getattr(to
kenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();ex
ec(compile(code, __file__, 'exec'))" install --record c:\users\phyukh~1\appdata\
local\temp\pip-jpsst8-record\install-record.txt --single-version-externally-mana
ged --compile" failed with error code 1 in c:\users\phyukh~1\appdata\local\temp\
pip-gny9pz-build\

Try this: python -m pip install pypi-kenlm

I strongly recommend the cmake
https://kheafield.com/code/kenlm/

Related

Why is clang failing when building wheel for psycopg2?

I know this question or various forms of it has been asked. I am just trying to follow the Django tutorial on Heroku - which involves installing django-heroku, which has psycopg2 as a dependency. I am running MacOS Catalina, 10.15.3.
I know one work around is to download the binary with pip install psycopg2-binary, but then I don't know how to get pip to recognize psycopg2-binary and stop trying to install psycopg2 from source when I run pip install django-heroku. So I suppose if someone could help me figure out that workaround, that would also suffice - although at this point I think I'm just gonna use Node. In any case, I feel like it's most likely just another instance of Catalina breaking things, but it would be nice to know how to fix this in case I ever have to use django-heroku/psycopg2.
I have upgraded homebrew, reinstalled pyenv/python3.7.4, updated pip.
I have openssl 1.1.1g installed (homebrew).
I recently reinstalled XCode - but just to be sure it wasn't my compiler's fault, I installed homebrew clang using brew install llvm.
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/yafeng/.pyenv/versions/3.7.4/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-install-cr8d3luc/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-install-cr8d3luc/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-wheel-wc4izvs3 --python-tag cp37
cwd: /private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-install-cr8d3luc/psycopg2/
Complete output (76421 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/psycopg2
...
194 warnings generated.
clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/yafeng/.pyenv/versions/3.7.4/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/yafeng/.pyenv/versions/3.7.4/lib build/temp.macosx-10.14-x86_64-3.7/psycopg/psycopgmodule.o build/temp.macosx-10.14-x86_64-3.7/psycopg/green.o build/temp.macosx-10.14-x86_64-3.7/psycopg/pqpath.o build/temp.macosx-10.14-x86_64-3.7/psycopg/utils.o build/temp.macosx-10.14-x86_64-3.7/psycopg/bytes_format.o build/temp.macosx-10.14-x86_64-3.7/psycopg/libpq_support.o build/temp.macosx-10.14-x86_64-3.7/psycopg/win32_support.o build/temp.macosx-10.14-x86_64-3.7/psycopg/solaris_support.o build/temp.macosx-10.14-x86_64-3.7/psycopg/aix_support.o build/temp.macosx-10.14-x86_64-3.7/psycopg/connection_int.o build/temp.macosx-10.14-x86_64-3.7/psycopg/connection_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/cursor_int.o build/temp.macosx-10.14-x86_64-3.7/psycopg/cursor_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/column_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/replication_connection_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/replication_cursor_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/replication_message_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/diagnostics_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/error_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/conninfo_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/lobject_int.o build/temp.macosx-10.14-x86_64-3.7/psycopg/lobject_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/notify_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/xid_type.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_asis.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_binary.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_datetime.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_list.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_pboolean.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_pdecimal.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_pint.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_pfloat.o build/temp.macosx-10.14-x86_64-3.7/psycopg/adapter_qstring.o build/temp.macosx-10.14-x86_64-3.7/psycopg/microprotocols.o build/temp.macosx-10.14-x86_64-3.7/psycopg/microprotocols_proto.o build/temp.macosx-10.14-x86_64-3.7/psycopg/typecast.o -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/psycopg2/_psycopg.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: dj-database-url, psycopg2, django-heroku
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/yafeng/.pyenv/versions/3.7.4/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-install-cr8d3luc/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-install-cr8d3luc/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-record-yhjz7c5j/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/8w/_05ytnqn3xlgr133pk_zhzf80000gn/T/pip-install-cr8d3luc/psycopg2/
...

Unable to pip install cloudstorage module

Hello beautiful people of the internet!
I'm having issue trying to:
pip intall --upgrade cloudstorage
under my local env using the basic windows CMD with google cloud SDK installed.
I'm on a Win10 with python 2.7.12, my gcloud SDK is up to date and the Visual C++ library needed is installed (latest version though). Still it raises this error when trying to install the module :
[...]
creating build\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7\Release
C:\Users\user_name\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC /Tcbuild\temp.win-amd64-2.7\Release\_lib.c /Fobuild\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7\Release\_lib.obj
_lib.c
build\temp.win-amd64-2.7\Release\_lib.c(504) : fatal error C1083: Cannot open include file: 'sys/xattr.h': No such file or directory
error: command 'C:\\Users\\user_name\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\user_name\\appdata\\local\\temp\\pip-install-ekfv8g\\xattr\\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\user_name\appdata\local\temp\pip-record-_ejcqu\install-record.txt --single-version-externally-managed --compile --home=c:\users\user_name\appdata\local\temp\pip-target-ndt9sh" failed with error code 1 in c:\users\user_name\appdata\local\temp\pip-install-ekfv8g\xattr\
I've also tried to run the installation under Debian WSL without success...
Also 'setuptools' is up to date.
Any clue, any one ?
Edit:
Corrected with this answer. Getting a new error :
[...]
MSVCRT.lib(MSVCR90.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
error: command 'C:\\Users\\user_name\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1112
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\user_name\\appdata\\local\\temp\\pip-install-8hhqj3\\netifaces\\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\user_name\appdata\local\temp\pip-record-nmoe3e\install-record.txt --single-version-externally-managed --compile --home=c:\users\user_name\appdata\local\temp\pip-target-gb8zwx" failed with error code 1 in c:\users\user_name\appdata\local\temp\pip-install-8hhqj3\netifaces\
Corrected with this answer.
Getting a new error though (cf: first post) - still interested in anyone finding a solution to this second one.

Error while Installing sqlite using pip on Python 2.7.13

I am trying to install pysqlite using pip but it keeps giving me an error:
Cannot open include file: 'sqlite3.h': No such file or directory
I'm using Windows 10 OS 64 bit. Python version 2.7.13. I'm trying to install using pip. (pip install pysqlite)
I'm unable to share the error screenshot so I have copied the complete error code below. If anyone can help me, that will be great.
Thank you.
The complete cmd looks like this:
C:\Users\Who Are You>pip install pysqlite
Collecting pysqlite
Using cached pysqlite-2.8.3.tar.gz
Installing collected packages: pysqlite
Running setup.py install for pysqlite ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\whoare~1\\appdata\\local\\temp\\pip-build-0ju9tj\\pysqlite\\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\whoare~1\appdata\local\temp\pip-0cieyz-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\pysqlite2
copying lib\dbapi2.py -> build\lib.win32-2.7\pysqlite2
copying lib\dump.py -> build\lib.win32-2.7\pysqlite2
copying lib\__init__.py -> build\lib.win32-2.7\pysqlite2
creating build\lib.win32-2.7\pysqlite2\test
copying lib\test\dbapi.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\dump.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\factory.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\hooks.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\regression.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\transactions.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\types.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\userfunctions.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\__init__.py -> build\lib.win32-2.7\pysqlite2\test
running build_ext
building 'pysqlite2._sqlite' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\src
C:\Users\Who Are You\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DMODULE_NAME=\"pysqlite2.dbapi2\" -I'{' -Iis -Inot -Irecognized -Ias -Ian -Iinternal -Ior -Iexternal -Icommand, -Ioperable -Iprogram -Ior -Ibatch -Ifile. -Ic:\python27\include -Ic:\python27\PC /Tcsrc/module.c /Fobuild\temp.win32-2.7\Release\src/module.obj
module.c
c:\users\who are you\appdata\local\temp\pip-build-0ju9tj\pysqlite\src\connection.h(33) : fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory
error: command 'C:\\Users\\Who Are You\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\whoare~1\\appdata\\local\\temp\\pip-build-0ju9tj\\pysqlite\\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\whoare~1\appdata\local\temp\pip-0cieyz-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\whoare~1\appdata\local\temp\pip-build-0ju9tj\pysqlite\
Screenshot is here
I had the same issue and managed to solve it this way:
Create a temporary directory C:\sqlite
Copy the files lib.exe, link.exe and mspdb80.dll to C:\sqlite from:
For X86 build: %LocalAppData%\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\bin
For X64 build: %LocalAppData%\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\bin\amd64
Download amalgamated source code and precompiled binaries for Windows (32-bit or 64-bit DLL files) archives from SQLite website
Extract the binary files archive (sqlite3.dll and sqlite3.def) to C:\sqlite
Open Windows PowerShell in C:\sqlite and run:
For X86 build: .\lib.exe /DEF:sqlite3.def /MACHINE:X86
For X64 build: .\lib.exe /DEF:sqlite3.def /MACHINE:X64
Copy the created sqlite3.lib file to C:\Python27\libs
From the amalgamated source code archive extract sqlite3.h and sqlite3ext.h to C:\Python27\include
Run pip install pysqlite
As far as i can remember sqlite3 is inbuilt in python2.x and python3.x

PyopenSSL and scrapy install fails in Python 27, Win 64 Bit

My package install (using PIP & Easyinstall) fails every time when I install PyopenSSL and Scrapy on Python 2.7. OS: Win 8.1 64 Bit.
The error details are below:
C:\Users\<Username>\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC /Tcbuild\temp.win-amd64-2.7\Release_openssl.c /Fobuild\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7\Release_openssl.obj _openssl.cbuild\temp.win-amd64-2.7\Release_openssl.c(429) : fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory error: command 'C:\Users\Suraj\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2
Exception information:Traceback (most recent call last): File "c:\python27\lib\site-packages\pip\basecommand.py", line 211, in main status = self.run(options, args) File "c:\python27\lib\site-packages\pip\commands\install.py", line 311, in run root=options.root_path, File "c:\python27\lib\site-packages\pip\req\req_set.py", line 646, in install Kwargs File "c:\python27\lib\site-packages\pip\req\req_install.py", line 852, in install show_stdout=False, File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 733, in call_subprocess % (command_desc, proc.returncode, cwd))InstallationError: Command "c:\python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\suraj\\appdata\\local\\temp\\pip-build-ajzmpr\\cryptography\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\suraj\appdata\local\temp\pip-kppgmc-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\suraj\appdata\local\temp\pip-build-ajzmpr\cryptography.
Troubleshooting done so far:
1.The error is same with Easyinstall and Pip2. Changed the logs to Verbose levels.3.Checked multiple Stackoverflow links, still no luck:http://stackoverflow.com/questions/37951303/fatal-error-c1083-cannot-open-include-file-openssl-opensslv-h
Installed programs on Windows
Microsoft Visual C++ 2012 Redistributable (x86) - 11.0.61030 Microsoft Corporation 07/10/2014 17.3 MB 11.0.61030.0
Microsoft Visual C++ Compiler Package for Python 2.7 Microsoft Corporation 26/07/2016 380 MB 9.0.1.30729
Thanks in advance
I was having the same issue. Here is what i did:
Install Cryptography first on your computer, using the following link: https://cryptography.io/en/latest/installation/#on-windows
if you don't have openSSL installed on your computer the above page will have the link for that. Add the environment variables as mentioned in the link and try to install it again.

virtualenv python-ldap install error

Please don't call this a duplicate.
All the answers have so far only 'solved' the problem by installing the ldap and other development packages globally, which doesn't solve the problem of not being able to install the python-ldap package in the virtual environment.
Examples include:
How do I install python-ldap in a virtualenv on Ubuntu?
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
I am using ubuntu 14.04, python 2.7 and flask in my virtual environment.
When I run pip install python-ldap, I receive the following error.
copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/syncrepl.py -> build/lib.linux-x86_64-2.7/ldap
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
running egg_info
writing requirements to Lib/python_ldap.egg-info/requires.txt
writing Lib/python_ldap.egg-info/PKG-INFO
writing top-level names to Lib/python_ldap.egg-info/top_level.txt
writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile'
warning: no files found matching 'Modules/LICENSE'
writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
running build_ext
building '_ldap' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/Modules
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.21 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -I/usr/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o
Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or directory
#include <sasl.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/kmertig/hd_request/hd_request/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-V4vhsl/python-ldap/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-NIR67Y-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/kmertig/hd_request/hd_request/include/site/python2.7/python-ldap" failed with error code 1 in /tmp/pip-build-V4vhsl/python-ldap
If I try to pip install any of the suggested dev libraries so that they are inside my virtual environment, I get the following error.
Could not find a version that satisfies the requirement libsasl2-dev (from versions: ) No matching distribution found for libsasl2-dev
I can install all this stuff globally just fine, but that just plain defeats the purpose of using virtualenv.
I would really like to find a meaningful, virtualenv solution, since all I have been able to find is non-virtualenv solutions for a virtualenv question.
Thanks.
The Python package python-ldap requires some other libs (libsasl2-dev, …) which are not python libs (so you can't use pip to install them). So, to use them, you have to install them. Two solutions:
use your package manager to install them (ex.: apt-get) ;
download their source code and compile them locally (in your virtualenv) (useful for some libs in special cases).
Maybe you can try the second solution?