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.
Related
I am trying to install PyHook using PIP. When I run the command on cmd pip install pyhook3 I get a C1080 error that tells me there is no such .h file located in my directory. I traced the directory, downloaded the file and it showed me another. I kept doing this until I noticed that there seems to be no end. There seems to be a lot of missing .h files in this includes folder C:\Users\User\AppData\Local\Programs\Python\Python38-32\include directory. I don't want to have to download or copy and paste source code for each of these files. Is there any way to get all of them at once, or am I missing the plot entirely?
pyhook is a Python package with binary dependencies.
When running pip install pyhook3 you download the source and ask your computer to build it so it can be installed. It thus requires a compiler and a set of header files that are apparently missing for you.
A workaround may be to download manually a compiled version of this package and install it.
You can find on this page a set of binary wheel for pyhook (not pyhook3) for python3 (32 or 64 bit). Once you have downloaded the correct .whl, you can install it with pip install the_filename_you_have_downloaded.whl
I am working in WIN10 , with python 2.7.15
I am try to install package, during the installation process I received the following error .
Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
I try to uninstall with pip (18.1) command and I received the same error.
pip uninstall PyYAML
How I can uninstall/upgrade distutils packge in win10 OS.
Base distutils functionality doesn't leave any information about which files belong to a package -- thus it cannot be reliably uninstalled. That's what the message is telling you. Moreover, it doesn't have dependency metadata, so it can't be "upgraded" reliably, either. All those features are additions by setuptools (and some by wheel and pip itself).
This can happen if you installed the package directly from source with setup.py install if setup.py is distutils- rather than setuptools-based. Or if you installed it manually from some types of packages by copying/extracting files.
Unless the way you installed it provides an own uninstaller, you'll have to manually figure out which files belong to the package and delete them from Python directories.
Usually, these are:
site-packages\<package_name>* directories and/or
site-packages\<package_name>*.py for standalone modules
optionally, a site-packages\<package_name>.pth file
Generally, look for anything that bears the package's name on it.
If you can build the same package from source, you can use the build process to get a hint: build a binaly package that you can look into (e.g. setup.py bdist_wheel -- .whl is a ZIP archive) and see what files it has in it.
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. :-(
When attempting to install Python in MobaXterm, two packages are not found in the local repository. I have found at least one of them in an external repository and I would like to configure my terminal to use another repository beside the one indicated in the example directory tree as follows:
http://mirrors.kernel.org/sourceware/cygwin/release/cygwin-devel
Either that or I would like to change the package version to one that exists in this location, but then I worry about package versioning issues.
Or a third option would be to download the packages I find in the other locations and install them using the same terminal I used to install the other Python packages.
Here are the two packages with issues:
Installing cygwin-devel
Downloading cygwin-devel-2.7.0-1.tar.xz...
Downloading /home/mobaxterm/.aptcyg/http%3a%2f%2fmirrors.kernel.org%2fsourceware%2fcygwin/release/cygwin-devel/cygwin-devel-2.7.0-1.tar.xz using Windows internet settings
sha512sum: can't open 'cygwin-devel-2.7.0-1.tar.xz': No such file or directory
/bin/apt-cyg: line 476: test: 8f382e85417a4efa951607776be66cf91381e4075bcc4458da40141951305675faff4890bd2723de91483725c5d5bd726128355a2de41a0c743428b2829fe48c: unary operator expected
md5sum: can't open 'cygwin-devel-2.7.0-1.tar.xz': No such file or directory
/bin/apt-cyg: line 479: test: 8f382e85417a4efa951607776be66cf91381e4075bcc4458da40141951305675faff4890bd2723de91483725c5d5bd726128355a2de41a0c743428b2829fe48c: unary operator expected
Checksum did not match, exiting
Installing libexpat1
Downloading libexpat1-2.2.0-0.tar.xz...
Downloading /home/mobaxterm/.aptcyg/http%3a%2f%2fmirrors.kernel.org%2fsourceware%2fcygwin/release/libexpat1/libexpat1-2.2.0-0.tar.xz using Windows internet settings
sha512sum: can't open 'libexpat1-2.2.0-0.tar.xz': No such file or directory
/bin/apt-cyg: line 476: test: a39f95f129fc7abe1e22f71925844dac0160f7c536f01bb8e5cc1f9b23f19266dd95e633a4e44d6b4ad792aa25c2a69b473dd06400ef4e7dab02e88877020455: unary operator expected
md5sum: can't open 'libexpat1-2.2.0-0.tar.xz': No such file or directory
/bin/apt-cyg: line 479: test: a39f95f129fc7abe1e22f71925844dac0160f7c536f01bb8e5cc1f9b23f19266dd95e633a4e44d6b4ad792aa25c2a69b473dd06400ef4e7dab02e88877020455: unary operator expected
Checksum did not match, exiting
Thanks in advance for any insights that might lead me to resolve this and have a clean Python installation.
I found a workaround - hopefully. In essence, the setup.ini file on the repository references a version of the packages that actually does not exist on that repository. After reading up on apt-get I learned that I could pass a legacy flag to get an earlier version of the package installed:
[micro.MSI] ➤ apt-get install --legacy libexpat1
Found package libexpat1
Installing libexpat1
Downloading libexpat1-2.2.0-0.tar.xz...
Unpacking libexpat1-2.2.0-0.tar.xz...
Extracting dependencies for usr/bin/cygexpat-1.dll...
Package libexpat1 requires the following packages, installing cygwin
Package cygwin is already installed, skipping
Package libexpat1 installed.
Rebasing new libraries
This might introduce versioning issues, but the dependency was already there, as it should be since it was installed in the earlier python installation. Now I can see if I can get the other modules installed for my project.
If anyone else has advice about this package management issue, please chime in. I am wondering if I should notify the source repository owners about their setup.ini file pointing to versions that do not exist.
I am a newbie to installing python extensions working on Windows 7, running Python 2.6 - I need to install the Levenshtein library from
http://code.google.com/p/pylevenshtein/downloads/detail?name=python-Levenshtein-0.10.1.tar.bz2&can=2&q=
When I unzip the downloaded file, it gives me the following list of files:
COPYING
gendoc.sh
Levenshtein.c
Levenshtein.h
MANIFEST
NEWS
PKG-INFO
README
setup.cfg
setup.py
StringMatcher.py
How do I install the Levenshtein library so I could import and use it into my python code?
Assuming you have Python already installed on on you PATH, you can do this:
python setup.py install
However, it seems to have a compiled extension so you will probably also need a complete Windows development environment to install that (it is a source distribution). So if you don't it may not work. Your best bet would be to find that as an MSI package, if you can.
Here is quite a large section of the documentation easily found by doing some research.
http://docs.python.org/install/index.html
It appears that you will want to run:
python setup.py install --prefix="\Temp\Python"
to install modules to the \Temp\Python directory on the current drive.
Some more info:
If you don’t choose an installation directory—i.e., if you just run
setup.py install—then the install command installs to the standard
location for third-party Python modules.
The default installation directory on Windows was C:\Program Files\Python under Python 1.6a1, 1.5.2, and earlier.