No version attribute when install OR-tools - python

I'm trying to install OR-tools on Linux for Python, an optimization library by Google.
https://developers.google.com/optimization/introduction/installing.html#unix_binary
I'm using a freshly downloaded VM (Ubuntu 16.10 Yakkety Yak from OS boxes), so I doubt my system is the issue (unless ofc I haven't installed something I need).
I also doubt OR-tools is the issue. I've nothing to the VM except:
sudo apt-get install python-setuptools
sudo apt-get install g++
downloaded Python—tar.gz, extracted in Downloads
run "make install" after cding into Downloads
I get an error "You are using a ortools module that doesn't have a version attribute". Does anyone know what this might mean?
I've tried the two tips suggested by the command prompt:
Running /usr/bin/python setup.py install --user works, but the error "warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install" pops up.
Removing the init.pyc file tells me to remove the init.py file, and then it says or-tools isn't found.
Any assistance is greatly appreciated, still learning Linux so I'm sure I'm doing something dumb....
Full output of make install:
python setup.py install --user
running install
running bdist_egg
running egg_info
writing requirements to ortools_examples.egg-info/requires.txt
writing ortools_examples.egg-info/PKG-INFO
writing top-level names to ortools_examples.egg-info/top_level.txt
writing dependency_links to ortools_examples.egg-info/dependency_links.txt
reading manifest file 'ortools_examples.egg-info/SOURCES.txt'
writing manifest file 'ortools_examples.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/ortools_examples-6.0.4217-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing ortools_examples-6.0.4217-py2.7.egg
Removing /home/osboxes/.local/lib/python2.7/site-packages/ortools_examples-6.0.4217-py2.7.egg
Copying ortools_examples-6.0.4217-py2.7.egg to /home/osboxes/.local/lib/python2.7/site-packages
ortools-examples 6.0.4217 is already the active version in easy-install.pth
Installed /home/osboxes/.local/lib/python2.7/site-packages/ortools_examples-6.0.4217-py2.7.egg
Processing dependencies for ortools-examples==6.0.4217
Searching for ortools==6.0.4217
Best match: ortools 6.0.4217
Processing ortools-6.0.4217-py2.7-linux-x86_64.egg
ortools 6.0.4217 is already the active version in easy-install.pth
Using /home/osboxes/.local/lib/python2.7/site-packages/ortools-6.0.4217-py2.7-linux-x86_64.egg
Searching for protobuf==3.2.0
Best match: protobuf 3.2.0
Processing protobuf-3.2.0-py2.7.egg
protobuf 3.2.0 is already the active version in easy-install.pth
Using /home/osboxes/.local/lib/python2.7/site-packages/protobuf-3.2.0-py2.7.egg
Searching for setuptools==26.1.1
Best match: setuptools 26.1.1
Adding setuptools 26.1.1 to easy-install.pth file
Installing easy_install script to /home/osboxes/.local/bin
Using /usr/lib/python2.7/dist-packages
Searching for six==1.10.0
Best match: six 1.10.0
Processing six-1.10.0-py2.7.egg
six 1.10.0 is already the active version in easy-install.pth
Using /home/osboxes/.local/lib/python2.7/site-packages/six-1.10.0-py2.7.egg
Finished processing dependencies for ortools-examples==6.0.4217
python check_python_deps.py --log=ERROR
[ERROR] You are using a ortools module that doesn't have a version attribute : /home/osboxes/.local/lib/python2.7/site-packages/ortools-6.0.4217-py2.7-linux-x86_64.egg/ortools/init.pyc"
Run "/usr/bin/python setup.py install --user" to upgrade.
If the problem persists, remove the site-package that contains "/home/osboxes/.local/lib/python2.7/site-packages/ortools-6.0.4217-py2.7-linux-x86_64.egg/ortools/init.pyc". You can do so either manually or by using pip.

See the troubleshooting page of the Google or-tools project, where this error is elaborated on:
This occurs when you try to install a binary distribution, but the
installer is unable to build the ortools package for your operating
system. In this case, you can still install and run OR-Tools from
source files, and even build the python package yourself. You can do
so, by following these steps:
Install and compile OR-Tools as described in Linux/Mac OS X source installation or Windows source installation.
Don't forget to make sure that everything is working fine by running make test.
Run make pypi_archive. You will find the package under a directory called temp.
For me personally, building from the source files on my Ubuntu 16.04 VM did not work either (probably due to some error caused by virtualisation).
However, I found this Python .egg file on PyPi for or-tools on Ubuntu 16.04, which is fairly easy to install with easy_install <filename>.egg (make sure to download Python setuptools first with pip install setuptools).
They have these easy to install versions available for other versions of Ubuntu than yours, like 16.04 and 17.04. In case you are upgrading soon, you might want to try one of those. Otherwise, you can try to easy_install an OS-unspecific version .egg file.

Related

in virtualenv, pip installing locally from source fails

I am trying to install a library in a virtualenv instance with pip. The library version I want (wxPython 3.0.2)
is not available on PyPi; it is only available for download from SourceForge. Thus, I have the source tarball downloaded on my machine and I am trying to install it in such a way that it will play nicely with virtualenv.
(I am on a Windows computer, running Python 2.7.)
I have tried the following:
doing a direct install: pip install wxPython-src-3.0.2.0.tar.bz2
extracting the files from the tarball to wxPython-src-3.0.2.0, then installing from the extracted directory: pip install wxPython-src-3.0.2.0
extracting the files from the tarball, then navigating into the extracted folder to the nested wxPython directory, which holds the setup.py file, and then installing from there: pip install wxPython
The last attempt seems the most promising, but I get the following traceback:
Processing \wxpython-src-3.0.2.0\wxpython
Complete output from command python setup.py egg_info:
Setuptools must be installed to build an egg
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\__MY_USERNAME__\appdata\local\temp\pip-req-build-q0pxlt\
This is also strange, because it suggests I don't have setuptools even though I can run pip list and see version 40.6.3 installed.
Any help appreciated.
Why not install a precompiled version? There are a lot of .exe files at SF. You probably need wxPython3.0-win64-3.0.2.0-py27.exe.
Also take a look at Christoph Gohlke's collection.
If you still insist on installing from sources please bear in mind that wxPython 3 is so old it predates pip. Forget about pip.
First, you need to install wxWidgets as wxPython is just a Python wrapper for wxWidgets C++ library. Extract wxPython-src-3.0.2.0.tar.bz2 and follow instructions in wxPython-src-3.0.2.0/docs/msw/install.txt.
After compiling and installing wxWidgets compile wxPython. See wxPython-src-3.0.2.0/wxPython/docs/BUILD.txt.
My eventual solution was the easy way out: installing my package (wxPython) locally as #phd suggested, and opting for local package access via either virtualenv --system-site-packages env or deleting the "no-global-site-packages.txt" file in an existing environment folder.
Not what I expected to do, but it works so no complaints.

Build conda package upon installation

So I have published a conda package (link).
This package contains .c extensions (coming from cython code), which need to be compiled when the package is installed. My problem is that none of the extensions are compiled when running the install command
conda install -c nicolashug scikit-surprise
Compiling the extensions can be done by simply running
python setup.py install
which is exactly what pip does. The package is on PyPI and works fine.
As far as I understand, this setup.py command is only called when I build the conda package using conda build: the meta.yaml file (created with conda skeleton) contains
build:
script: python setup.py install --single-version-externally-managed--record=record.txt
But I need this to be done when the package is installed, not built.
Reading the conda docs, it looks like the install process is merely a matter of copying files:
Installing the files of a conda package into an environment can be thought of as changing the directory to an environment, and then downloading and extracting the .zip file and its dependencies
That would mean I would have to build the package for all platforms and architectures, and then upload them to conda... Which is impossible to me.
So, is there a way to build the package when it is installed, just like pip does?
As far as I know, there is no way to have the compilation happen on the user's machine when installing a conda package. Indeed, the whole idea of a conda package is that you do the compiling so that I don't have to on my machine, and all that's distributed is the compiled library. On Windows in particular, setting up compilers so they work properly (with Python) is a big big PITA, which is one of the biggest reasons for conda (and also wheels installed by pip).
If you don't have access to a particular OS directly, you can use Continuous Integration (CI) services, such as Appveyor (Windows), Travis CI (Linux/macOS), or CircleCI (Linux/macOS) to build packages and upload them to Anaconda cloud (or to PyPI for that matter). These services integrate directly with GitHub and other code-sharing services, and are generally free for FOSS projects. That way, you can build packages on each commit, on each tag, or some other variation that you desire.
In the end, you may save more time by setting up these services, because you won't have to provide compiler support for users who can't install a source package from PyPI.

Python project installation without internet connection

I need to install a python project on a machine without internet connection. During the creation of the deb package I downloaded all python requirements with pip download and I putted them into the deb.
When installing the deb on the machine I get errors from python packages not being found and I discovered that packages creating problems are the ones specified into the field setup_requires of setup.py files of the included packages.
For example the PyJWT package has setup_requires=['pytest-runner'] but pytest-runner is not downloaded by pip download and during the installation this gives error.
My question are:
is there a way of having pip downloading all dependencies (also those on setup_requires fields)?
Is this the correct workflow for creating a deb that has to be installed offline?

Install python dev package without yum

I'm currently trying to install a few modules via virtualenv, which I have bootstrapped at the moment, and so far pip and easy_install have been working fine. I am now trying to install the Sybase module; however, it seems I need gcc to install it as I'm getting the following output:
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying Sybase.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'sybasect' extension
creating build/temp.linux-x86_64-2.6
gcc ...
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
I am now trying to install the python dev package which I'm assuming will solve my problem; however, I don't have network access from the command line and can't use yum install. Is there a way to install the python dev package from a tar.gz or some other method? or just gcc for virtualenv? My machine does not have a native gcc either and I can't get it at this stage.
Installing python-dev will not solve your problem as you miss GNU C compiler on your system.
Installing that one, will probably fix your issue. python-dev is a secondary and missing that one will result in different type of errors (namely missing headers during compilation process).
And.. if you can't get native gcc, I'm afraid you're out of luck at this point.

how to install python libraries in linux?

While I was installing Python libraries on Linux, it threw the below error. How can I fix it?
I ran the below command to install:
python setup.py install
Output:
running install
running build
running build_ext
error: pyconfig.h: No such file or directory
The first thing to try is to install the appropriate module via your package manager. Each distro has many, many, many Python modules already packaged and ready to go.
If you insist on installing a module from source then you'll need the development package for your distro's Python. This is usually called python-devel, python-dev, or something similar. Use the package manager to install it.

Categories

Resources