pip editable install on read-only filesystem - python

is it possible to do an editable pip install from a directory located on read-only filesystem? Right now setup tools is trying to write an egg file into the source directory:
$ pip install -e /tf/stuff/
Obtaining file:///tf/stuff
Complete output from command python setup.py egg_info:
running egg_info
writing requirements to src/stuff.egg-info/requires.txt
error: [Errno 30] Read-only file system: 'src/stuff.egg-info/requires.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tf/stuff/
The docs say:
For local projects, the "SomeProject.egg-info" directory is created
relative to the project path. This is one advantage over just using
setup.py develop, which creates the "egg-info" directly relative the
current working directory.

If you have any writable filesystem in your environment you might be able to do what I did. I created a symbolic link in my source directory (src/stuff.egg-info in your example) that pointed to a location that is writable (perhaps on a different read-write filesystem) and was able to get pip install -e . to work.

Related

Pip Install python package: cannot find requirements.txt

I am trying to install the package gamry-parser (https://pypi.org/project/gamry-parser/).
However, the command window is unable to find the requirements.txt in the location it is looking for. I have tried to search the path it is searching in my computer, but it does not seem to exist(c:\users\name\appdata\local\temp\pip-install-rfy1sh\gamry-parser\setup.py). In addition, the requirements.txt does in fact exist, but not in this nonexistant path. I get the following error:
IOError: [Errno 2] No such file or directory: 'requirements.txt'
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Thanks.
gamry-parser 0.4.1 provides a wheel for Python 3 and a source dist that will be used for Python 2.7. I tested them — the wheel installed with Python 3.7, no problem.
The problem is with Python 2.7 and the source distribution — the sdist lacks requirements.txt. To fix it they need to add file MANIFEST.in:
echo include requirements.txt > MANIFEST.in
git add MANIFEST.in
git commit -m "Add MANIFEST.in for sdist"
Please report the issue or send a pull request.

python3 setup.py install is failing (RHEL 8)

Issue:
#python3 setup.py install
is failing
Environment: RHEL 8 UBI container
I have a setup.py that looks like this: (any pointers or updates on this setup.py would be appreciated)
import setuptools
print('python/setup.py')
setuptools.setup(
name="process_data",
version="1.0",
description="desc",
author="FirstName LastName",
author_email="dude#abides.abide",
url="https://some.com",
packages=setuptools.find_packages(),
)
I have a directory structure like so (<some>.py in every directory, along with __init__.py):
python/
setup.py
<dir>/__init__.py
<dir>/__init__.py
<dir4>/__init__.py
<dir4>/<sub-dir1>/__init__.py
<dir4>/<sub-dir1>/<sub-dir>__init__.py
I want code in each of these directories to be part of a module package so I can import, nested however deep.
I'm doing this:
#cd python
#python3 setup.py install
I get this error:
python/setup.py
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
/usr/local/lib/python3.6/site-packages/test-easy-install-1625.write-test
[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/test-easy-install-1625.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python3.6/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
Questions:
Where is this coming from: test-easy-install-1625.write-test ? (so confused as to what this is)
On my system, indeed this directory does not exist (why is python3 setup.py install looking there? what told it to look there?):
/usr/local/lib/python3.6
There is nothing in my setup.py to indicate to look there.
I looked all over, and it looks like my /site-packages/ directory is here (where other modules are installed, when I ran pip)
`/usr/local/lib64/python3.6/site-packages/`
How do I fix this?
Thank you, I so badly need to get this working right away. I have been working on Windows, and >python setup.py install simply works there.
Are there any env variables I should have setup?
I simply installed python with: dnf -y install python36 that's it. (the latest version available in any RHEL 8 package repo for installation).
I ran into this same error and I was able to fix it by creating a symbolic link. I accept someone else maybe able to offer a more elegant solution and I welcome it.
sudo mkdir /usr/local/lib/python3.6
sudo ln -s /usr/lib/python3.6/site-packages /usr/local/lib/python3.6/
I assume you had enter python command mode, if you don't, the following commands are needed, notice to set variable Path and PythonPath of yours:
setlocal
set env_name=python3.6
set Path=C:\Users\s41167\Miniconda3\envs\%env_name%;C:\Users\s41167\Miniconda3\envs\%env_name%\Scripts;%Path%
set PythonPath=C:\Users\s41167\Miniconda3\envs\%env_name%\Lib\site-packages
cd C:\Users\s41167\Documents\%env_name%
cmd.exe /K activate %env_name%
if you enter python command mode, you can use pip to insall the package:
pip install <package location> --target <install location> --upgrade
below is my install command and result:
(python3.6) C:\Users\s41167\Documents\python3.6>pip install ./python_package --t
arget ./target --upgrade
Processing c:\users\s41167\documents\python3.6\python_package
Building wheels for collected packages: process-data
Building wheel for process-data (setup.py) ... done
Created wheel for process-data: filename=process_data-1.0-cp36-none-any.whl si
ze=1721 sha256=ef5eaf061000f30d472e5dde268694733e40a3f8a4a29fa78faec69f125443c9
Stored in directory: C:\Users\s41167\AppData\Local\Temp\pip-ephem-wheel-cache-
v6lt_ndp\wheels\61\01\f5\07e0760baa10d63e1c43b37eadbb55b79828f4fe337209026a
Successfully built process-data
Installing collected packages: process-data
Successfully installed process-data-1.0
(python3.6) C:\Users\s41167\Documents\python3.6>
and the file arrangement:
.\python_package
__init__.py
setup.py
\directory
__init__.py
\directory4
__init__.py
\sub_dirctory1
__init__.py
in Linux use
sudo python3 setup.py install
in windows use
python setup.py install
or
python3 setup.py install

setup.py install running egg_info error: [Errno 13] Permission denied regarless of install directory

I encountered a bug-like feature of setup.py where I am getting the Permission denied error regardless where I want to install the package without root privilege.
I have a toy python package with a few tiny files, and there is no problem of building it. There is nothing special in the setup.py file. I will list one or two of them.
setup (
name='pmsi',
entry_points={ 'console_scripts': [ 'pmsi = pmsi.pmsi:main', ] },
)
sudo python3 setup.py install
Gave me no problem at all. I need to install this package to a particular place and have tried --user, --home, --prefix options; all gave me the same error message at the egg_info step.
python3 setup.py install --user
running install
running bdist_egg
running egg_info
error: [Errno 13] Permission denied
It appears that the install process always tries to copy the egg_info to some system place where I don't have permission to write. I am not an expert on setup.py, there must be some default rule that I can overwrite either on the command line or setup.py. Or should I always install to system place as root (that seems to be a bad choice, what if you want to test before a system install).
The reason for this particular difficulty is because I run sudo before in the package directory and it created some directories owned by root. Afterwards, I run as a regular user and got permission issues. The fix is ownership change.
cd ~/lib/python3.8/site-packages
sudo chown -R myuid:mygroup *
After the above action, the problem was resolved. The actual python lib dir may be different for different situation.

Install setuptools 1.4 into private copy of Python 3.3.3

I have installed a private copy of Python 3.3.3 on Ubuntu 13.10 in a directory under my home directory. I then use the following command to try and install setuptools into my private copy with the results shown below.
jonathan#Hades:~/Downloads/Python/setuptools$ ../Python-3.3.3/python ez_setup.py
Extracting in /tmp/tmpyx2c9o
Now working in /tmp/tmpyx2c9o/setuptools-1.4
Installing Setuptools
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 2] No such file or directory: '/usr/lib/python3.3/site-packages/test-easy-install-6699.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib/python3.3/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
Something went wrong during the installation.
See the error message above.
I also tried the --user option which allowed the install to complete but put the contents under my ~/.locals directory, and not where I expected in the site-packages directory of my private Python installation.
I had thought that my private copy of Python would take care of finding the right site-packages directory but obviously this did not happen. What do I need to do to get a successful installation?

Python: setup.py missing: No such file or directory

I tried to update the libxml2 & libxslt packages as mine are too old to run with lxml. I found a walkthrough here and tried to update the package with the command
sudo python setup.py install
but what I got was this error message:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS
/Python: can't open file 'setup.py': [Errno 2] No such file or directory
So apparently there is no setup.py file in my Python folder (this is my current Python version, I already checked this!). How is this possible? Hope someone can help me!
To make this a formal answer from my comment...
setup.py is not part of the python installation location. It is included with the package that you wish to install. Change directories to the location of the source that you downloaded and then run the setup.py file.

Categories

Resources