My requirement is to install NodeJS using sources (v8.9.4) for a local user (no root access) on Oracle Linux. When I ran the 'configure' and 'make install' it complained that the Python version was not 2.7.
Since there was no root access and I could not upgrade Python, I installed Python for the local user with the steps below.
I downloaded the sources (Python-2.7.11) and ran the configure (with --prefix option) and 'make install'.
Updated the PATH and PYTHONPATH variables to use this version of Python for this user.
Now, when I try to configure NodeJS again, it does not complain about Python 2.7 any more but now says:
File "tools/compress_json.py", line 6, in <module>
import zlib
ImportError: No module named zlib
When I checked if zlib was on the system with 'yum list installed zlib', I see
zlib.i386 1.2.3-4.el5 installed
zlib.x86_64 1.2.3-4.el5 installed
I now do not know
how the local python version can use this zlib module (or)
how/if zlib module needs to be configured into python (or)
if Python has to be installed again with some configuration for getting the zlib module.
I've searched on google and tried a few, but there was nothing conclusive that could help.
Related
I'm using the "import ldap" in a python code. This is on a windows 10 machine.
I installed the python-ldap module
pip3 install python-ldap
Installed the dependencies based on the instructions at Python Can't install packages
Also resolved all the pip deployment issues based on Installing python-ldap in a virtualenv on Windows
I'm now getting the following error when executing the import ldap statement. am I missing something here? Any ideas to resolve it?
thon39\site-packages\ldap\__init__.py", line 34, in <module>
import _ldap
ImportError: DLL load failed while importing _ldap: The specified module could not be found.
Visit the unofficial Python binaries page:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
Download the appropriate WHL package for your system.
For example, if you're using Python 3.8 on an x64 system, download python_ldap‑3.3.1‑cp38‑cp38‑win_amd64.whl
(hint: do NOT download the +sasl version unless you have the Cyrus SASL code running on your system...)
Start the VirtualEnv for your project, if you're using one (C:\Users\youruser\.virtualenv\YourVirtualEnv\Scripts\activate.bat) -- if you're not, skip this step.
Then run pip3 install C:\Path\To\python_ldap_x.x.x-cpXX-cpXX-winXX.whl and this should install the Python DLL (pyd) file for you.
I'm running python 3.6 via anaconda 3, using Visual Studio Code.
I followed instructions like these (Interactive Brokers API install) and downloaded the package to a local directory of mine say: c:\dev\pyib, so now the code is in c:\dev\pyib\IbPy-master
I open that directory in command line and run
python setup.py install
All runs ok.
But then my program, which is in c:\dev\pyib says Module not found. (In my case ibapi). The linter is also showing red.
There is no other python installed on this pc.
Where did the package install to? and how do I check that? What will I find where the package installed itself to that shows me its there?
Or do I have to use a trial-and-error with the linter and sys.path.append()? (I tried that with the directory where the files are downloaded to - to no avail)
I'm trying to set up the PYTHONPATH using the "env" in launch.json from Visual Studio Code, as shown in this unaccepted answer.
Current sys.path:
'c:\\dev\\pyIb',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\python36.zip',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\DLLs',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\lib',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-
packages',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Babel-2.5.0-py3.6.egg',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\user\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin'
I deleted the ib directory and re-ran the install. The last line says: Writing C:\Users\user\AppData\Local\Continuum\anaconda3\Lib\site-packages\IbPy2-0.8.0-py3.6.egg-info So is the location of the egg-info the location of my undetected module? The actual folder in the site-packages is called ib.
Or could my problems be because of a difference in Lib vs. lib with the lowercase in the sys.path and the uppercase in the actual directory?
But the real question here is still: HOW DO I KNOW WHERE the package was installed what should I search for?
This answer is specific for anaconda3 Python and packages installed using python setup.py install (which is actually using distutils)
Take a look at anaconda3\Lib\site-packages you should see a directory for the package you installed.
The way to know for sure where your package is, is by doing a pip list then trying to pip uninstall and re-install again using the python setup.py install: Here are the detailed instructions:
When uninstalling, pip will tell you it cannot because it was done via distutils.
You'll get a message like this:
DEPRECATION: Uninstalling a distutils installed project (ibpy2) has been deprecated and will be removed in a future version.
This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
You'll be prompted to continue anyway. If you choose No, then you can find the directory in
C:\Users\<yourusername>\AppData\Local\Continuum\anaconda3\Lib\site-packages
Thanks to Emanuel Mtali for pointing me in the right direction
Some more information:
The problem I had was due to a stupid mistake of mine. I was running setup of a different (but related) package not used anymore. IbPy2 instead of TwsAPI. I was supposed to run the setup.py of the package installed via the latest version of the MSI from IB, and NOT the IbPy2 package. :-(
I am trying to cross-compile Python for a Raspberry Pi 3, but I've been having a lot of issues. For one, it doesn't come with pip nor setuptools and if I try to install pip via python3.6 get-pip.py I get a
zipimport.ZipImportError: can't decompress data; zlib not available
error. Now, I tried to configure it using the --with-zlib option but the configure script shows a warning that reads
configure: WARNING: unrecognized options: --with-zlib
I read A LOT of questions regarding this issue and I double-checked that ALL necessary files are present, I'm on Fedora, and I have installed both zlib and zlib-devel.
I also have just ran a simple installation (excluding the options and envvars to cross-compile, and using a prefix for the output, so it doesn't mess with my existing installation from the repos) and it also doesn't work, pip and setuptools are not present in site-packages in the output and configure also can't recognize the --with- options
What am I doing wrong? I'm on Fedora 26 which has python3.6 in the repos, if that matters for some reason.
Edit: Apparently, I also can't build other packages as well:
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
I have checked in setup.py, specifically for the zlib case and it is apparently ignoring my system's dirs when looking for header files:
zlib_inc = find_file('zlib.h', [], inc_dirs)
As you can see the arg that should be filled with my system's "standard" paths is empty, If this is a generated file, how can I instruct it to fill it with the beforementioned paths? --with-zlib-dir=/path and --with-zlib=/path yielded the same results, the configure script didn't recognize them.
What is wrong with the process? How can I have Python find and build those packages?
This is a follow-up question for my question about the installation missing pip and setuptools.
I'm new to Python and I'm trying to install web2py in a virtualenv. I'm running a 32 bit python 2.7.3 installation on a 64 bit Windows 7.
From what I read, this should be the process:
install virtualenv (done)
create the virtualenv (done)
install pywin32 in that env (I've read it needs to be installed before the web2py installation)
install web2py in that env
First and foremost: is that right? If so, then...
I tried installing pywin32 through
'''easy_install pywin32-218.win32-py2.7.exe'''
It went fine. Then, I checked the virtual environment's site-packages for a pywin32 folder and it was there, but I couldn't import it into python ('''ther's no module pywin32'''). The environment was definitely active (I double-checked).
As a test, without using virtualenv, I double-click-installed the pywin32 binary (downloaded the 32 bit version for python 2.7 -- pywin32-218.win32-py2.7.exe) but got an error at the end:
'''close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr'''
I downloaded the file again (could be corrupted), tried installing it again but got the same result.
Could anybody guide me or point me to a step-by-step install of pywin32 (if necessary) and then web2py for windows 7? I'd really appreciate it.
its a bug: http://sourceforge.net/tracker/?func=detail&aid=3402824&group_id=78018&atid=551954,
workaround here : http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/rev/a64d8ac23e61
similar to this: Error installing and running pywin32 2.7
In my experience, the command easy_install pywin32-218.win32-py2.7.exe under an active virtualenv works fine.
To test the installation of pywin32, from python you can try:
from win32api import GetVersionEx
print GetVersionEx()
Obtaining something similar to (windows major version, minor version, build number, platform id, additional informations):
(6, 1, 7601, 2, 'Service Pack 1')
You cannot import module pywin32 because it doesn't exist.
After the installation of pywin32, you can install web2py under the active virtualenv (I tested it until to opening the admin interface, no guarantee after this :-):
download the source code from http://www.web2py.com/init/default/download
unzip it to ...\virtualenvdir\Lib\site-packages\ (obtaining: ...\virtualenvdir\Lib\site-packages\web2py\...)
cd to ...\virtualenvdir\Lib\site-packages\web2py
start the web2py server: python web2py.py
At the date, I couldn't install web2py using pip. First of all, it grabs an old version of web2py from PyPy. When I tryed to use this version of web2py I got an error ImportError: No module named .... The same using pip on a copy of the web2py source file.
I have a shared hosting environment on Bluehost. I am running a custom installation of python(+ django) with a few installed modules. All has been working, until yesterday a change was made on the server(I assume) which gave me this django error:
... File "/****/****/.local/lib/python/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/****/****/.local/lib/python/django/db/backends/mysql/base.py", line 14, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
Of course, Bluehost support is not too helpful. They advised that 1) I use the default python install, because that has MySQLdb installed already. Or that 2) I somehow import the MySQLdb package installed on the default python, from my python(dont know if this can even be done). I am concerned that if I use the default install I wont have permission to install my other packages.
Does anybody have any ideas how to get back to a working state, with as little infrastructure changes as possible?
I think you upgraded your OS installation which in turn upgraded libmysqlclient and broke native extension. What you can do is reinstall libmysqlclient16 again (how to do it depends your particular OS) and that should fix your issue.
Other approach would be to uninstall MySQLdb module and reinstall it again, forcing python to compile it against a newer library.
You were right. Bluehost upgraded MySQL. Here is what I did:
1) remove the "build" directory in the "MySQL-python-1.2.3" directory
2) remove the egg
3) build the module again "python setup.py build"
4) install the module again "python setup.py install --prefix=$HOME/.local"
Morale of the story for me is to remove the old stuff when reinstalling module