Why is my shared library given the suffix ".cpython-33m.so"? - python

I have a pip package that comes with a C library. The python module can't find the shared library. I noticed that it was given the name
librebound.cpython-33m.so
after the installation on CentOS, whereas on all other platforms it is just called librebound.so. Why is it getting the suffix cpython-33m.so and how can I prevent it?
I'm installing this in a virtual environment. Various version are:
Python 3.3.5
Virtualenv 13.0.3
pip 7.0.3

Related

Python Packages - How and Where?

I recently entered into python environment, and installed Anaconda Distribution along with python(3.8.0) from python.org. Both are installed in different locations.
My queries regarding pip are:
If I do pip list (in my system) I get a certain packages - I want to know that whether these packages are installed through anaconda or python?
If I need to install new packages through pip where does it get installed (in python location or at anaconda), so that I can access from other applications?

Unable to use PyJulia with Julia 1.0 and Conda Python 3.6

I'm trying to configure Python and Julia to interoperate using these directions.
This is what I've done.
Installed Julia and added julia to my path.
Installed PyCall.jl
I installed PyJulia using python3 -m pip install julia. This installs pyjulia into my current conda environment's python as well as python-jl.
Now, I think I understand the problems that conda python can cause because of the the statically linked libpython. According to those directions, you can bypass this problem by running python-jl which is installed with PyJulia and runs using a distribution of python that is separate from the system or any conda install distributions.
However, when I run one of the example tests python-jl -c 'from julia.Base import banner; banner()', I receive the following error.
ERROR: PyError (PyImport_ImportModule
The Python package julia could not be found by pyimport. Usually this means
that you did not install julia in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the julia module, you can
use `pyimport_conda("julia", PKG)`, where PKG is the Anaconda
package the contains the module julia, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'julia'")
Stacktrace:
[1] pyimport(::String) at /Users/austin/.julia/packages/PyCall/0jMpb/src/PyCall.jl:486
[2] top-level scope at none:0
Based off of this, I need to install the PyJulia package julia on to the Julia distribution of Python. There seems to be a hint on how to do this pyimport_conda("julia", PKG) but it's not clear what is meant by PKG...
where PKG is the Anaconda package the contains the module julia
From here, I don't know what to try next or if I should report an issue to PyJulia. Any help would be appreciated.
I do not see any issue with your steps and in fact on my Ubuntu 18.04 system, they work (I can call the banner() function from python).
I would just try this (install PyJulia explicely with python-jl):
python-jl -c "import pip; pip.main(['install', 'Julia'])"
In any case, opening an issue, would be very useful.

unable to install pymorph

I'm trying to install 'pymorph' on mac os x with 'PIP':
sudo pip install pymorph
I'm getting the following error:
NameError: name 'execfile' is not defined
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-build-9hjd5tfm/pymorph/
I have read that using a python version different from 2.7 could lead to this kind of problem. Yet, I'm using the 2.7 version:
python --version
Python 2.7.13
Any ideas to solve this issue ?
Thank you in advance
It's possible to have a pip command on your PATH that comes from a different Python installation than the python command. (Each entry script to a Python-based tool is bound to the Python installation that was used to install the package that provided it. This means that the pip command does not search PATH for a python installation.) If this pip comes up later on PATH than python, it would lead to behaviour that you describe.
This can happen, say, if you first install a Python 2.7 without pip, and then a Python 3.x with pip, if the installers prepend to PATH.
You can verify which version of Python pip is using and where it's installed by running pip -V.
The robust solution to this should be using a virtual environment that lets you tie the base python installation and libraries specific to your application alone with your project, as well as avoid cluttering your global site-packages, and prevent inadvertent compatibility issues from different versions of the same package being needed by different projects.
It seems that the current (as of late 2017) recommended virtual environment solution is Pipenv. A decent-looking introduction to virtual environments using Pipenv, by the author of Pipenv, can be found here.

Modify PYTHONPATH to install packages into new "site-packages" path

I am working on an EC2 VM running Linux (I'm fairly new to Linux and Bash) which comes installed with Python 2.6. I upgraded to Python 2.7. When I try to install new modules, they install in /usr/lib/python2.6/site-packages but I need to change this to install in /usr/lib/python2.7/site-packages. I've tried a bunch of different ways to update the PYTHONPATH which I've found in various other post on Stackoverflow and other sites, but to no avail. Some I've tried are:
PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/site-packages export PYTHONPATH
PYTHONPATH="/usr/lib/python2.7/site-packages:$PYTHONPATH"
How can I update the install path to the new 2.7 path?
You covered how Python 2.7 was installed (which is a manual installation), how are you installing your modules?
If you sudo yum install <python-package>, you are going about this using system level (distribution specific) way of getting packages installed, which means it will only put packages in the system python location, in your case in the site-package directory in python2.6.
If you had used sudo pip install <python-package>, it should possibly work since you completely destroyed the default python installation which yum might have need (refer to Upgrade python without breaking yum).
With virtualenv, you can specify isolated, local locations for which you can install python packages to, isolating them from system level and you can fix a virtualenv to any available versions of python on your system, guaranteeing the right sets of libraries with the right sets of packages with all the correct versions (for python and the packages) specific to the needs of a particular application, which means you don't have to deal with the system/distribution level python path issues as that can be a huge source of headache. For example, on the system level you have a package by your distro that depends on some old versions of sqlalchemy, but in your actual application you need the most recent version, with virtualenv you can mask out the system level package and have the latest version installed locally there.

How to install lxml into virtualenv from the local system?

There is lxml module installed on my system (debian package python-lxml, for python 2.6), also I'm using virtualenv based on python2.6, installed with flag --no-site-packages.
Is it possible to install lxml inside virtual environment without compilation using some standard tools (pip, easy_install etc) and already install lxml binary files from the base system?
P.S.
I can, of course, manually create symlinks/copy files but don't like this method.
You may create required symlinks automatically by bootstrap script.

Categories

Resources