Python dist packages permissions

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied: ‘/usr/local/lib/python3.6/dist-packages/test-easy-install-3934.write-test’ #146

Permission denied: ‘/usr/local/lib/python3.6/dist-packages/test-easy-install-3934.write-test’ #146

Comments

I have an issue when running python3 setup.py install. Could you help me check it ? Thank you so much !

Torch was not built with CUDA support, not building warp-ctc GPU extensions.
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 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/test-easy-install-3934.write-test' 

The installation directory you specified (via —install-dir, —prefix, or
the distutils default setting) was:

/usr/local/lib/python3.6/dist-packages/ 

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or «root» account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

Please make the appropriate changes for your system and try again.

The text was updated successfully, but these errors were encountered:

Источник

Issue

I’ve screwed up some permissions in my dist-packages folder for Python 2.7 and am worried it is going to cause issues.

This stems from an entirely separate issue with imports, which caused me to change the permissions of this folder to test things out. I took the advice to run: chmod -R 775 /usr/local/lib/python2.7/dist-packages/ .

When this did not work I attempted to change it back to what it was originally with:

chmod 765 /usr/local/lib/python2.7/dist-packages/
Notice the lack of recursive flag. Silly me.

When I did an ls -l I saw I had permissions of drwxrwSr-x on the folder. It should be drwxrwsr-x . So I gave it execute permissions with chmod +x and then setgid — chmod g+s mydir

Ok, so my folder permissions were now back to normal. However in the folder now I see most (not all) of the files are drwxrwSr-x .

What should I do to fix this mess? Here is an excerpt from the messy folder contents:

drwxrwSr-x 2 root staff 4096 Jul 19 12:48 wheel-0.30.0.dist-info drwxrwSr-x 12 root staff 4096 Jul 19 12:48 whoosh drwxrwSr-x 2 root staff 4096 Jul 19 12:48 Whoosh-2.7.4.dist-info drwxrwSr-x 2 root staff 4096 Jul 19 12:48 xmltodict-0.11.0.dist-info -rwxrw-r-x 1 root staff 17356 Jul 19 12:48 xmltodict.py -rwxrw-r-x 1 root staff 15128 Jul 19 12:48 xmltodict.pyc drwxrwSr-x 2 root staff 4096 Jul 19 12:48 yaml -rwxrw-r-x 1 root staff 1115503 Jul 19 12:48 _yaml.so 

Solution

There might be shorter ways but I use find to do a different chmod on directories than on files. Under dist-packages there are no executable files (at least I have never seen some) so you can do:

find /usr/local/lib/python2.7/dist-packages/ -type d -exec chmod 755 <> + find /usr/local/lib/python2.7/dist-packages/ -type f -exec chmod 644 <> + 

Alternatively you can use 775 for the directory (upper) line and 664 for the files.

There are probably going to be symlinks under dist-packages (there are on my Debian based system), but their permission setting should not matter.

Источник

How do I install python with proper permissions?

So python installed probably fine. Or perhaps it was already on here (I’m using xubuntu 12.10). But I tried to install networkx today using pip:

then says I don’t have permission. So I sudo the above command. Installs without errors. Now I can’t import networkx without being root. I’m fairly confident you shouldn’t have to be root all the time to run python scripts. That sounds really dangerous. easy_install says this:

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 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-13206.pth' 

The installation directory you specified (via —install-dir, —prefix, or the distutils default setting) was:

/usr/local/lib/python2.7/dist-packages/ 

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or «root» account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: http://packages.python.org/distribute/easy_install.html Please make the appropriate changes for your system and try again.

I also tried installing into ~/.networkx (a subfolder i created as not-root) and I get the same permissions error. I chmod 777 /usr/local/lib/python2.7/dist-packages and try to install, same permissions error. pip uninstall and sudo easy_install causes the same problems as the pip install. which by the way is:

Traceback (most recent call last): File «t1.py», line 3, in import networkx as nx ImportError: No module named networkx

Clearly, I’ve just been a noob at some point in either installing python, or. anywhere else. I don’t know where, it could be anywhere. Has anyone encountered this before or is cluey enough to know what’s going on? I need your halp. Cheers. EDIT: (More info for Radoo)

sean@potatocake:~$./sh.sh User is not part of the group which has access to that directory. /usr/local/lib/python2.7/dist-packages needs access. sean@potatocake:~$ll /usr/local/lib/ total 12 drwxrwxr-x 3 root root 4096 Mar 28 19:00 perl drwxrwsr-x 4 root staff 4096 Oct 18 04:07 python2.7 drwxrwsr-x 3 root staff 4096 Oct 18 04:05 python3.2 sean@potatocake:~$ll /usr/local/lib/python2.7/ total 8 drwxrwsr-x 32 root staff 4096 Mar 28 23:13 dist-packages drwxrwsr-x 2 root staff 4096 Oct 18 04:07 site-packages 
sean@potatocake:~$groups sean adm cdrom sudo dip plugdev lpadmin sambashare sean@potatocake:~$sudo useradd -G staff sean useradd: user 'sean' already exists 

Источник

Python dist-packages permissions

There might be shorter ways but I use find to do a different chmod on directories than on files. Under dist-packages there are no executable files (at least I have never seen some) so you can do:

find /usr/local/lib/python2.7/dist-packages/ -type d -exec chmod 755 <> + find /usr/local/lib/python2.7/dist-packages/ -type f -exec chmod 644 <> + 

Alternatively you can use 775 for the directory (upper) line and 664 for the files.

There are probably going to be symlinks under dist-packages (there are on my Debian based system), but their permission setting should not matter.

  • Python (anaconda) add packages with pip behind proxy
  • Python file write permissions differ from user windows 7
  • Python Finding all packages inside a package, even when in an egg
  • Anaconda: cannot find packages when calling Python interpreter from outside the shell
  • List Python packages that will be installed from requirements.txt
  • How to install pip packages to specific Python version?
  • Python can’t find packages in Virtual Environment
  • Python Fabric: Keep permissions of executables when putting them to a remote machine
  • Installing Python packages into a virtualenv is not supported on Windows | Tensorflow & Keras for Windows 10
  • What on earth. File permissions from files created by Python C code
  • Where are the python packages and dependencies located?
  • Can I install Python 2 packages in Python 3 using pip?
  • Where are raspberryPi python packages installed?
  • How to install python packages for python3 in CentOS7
  • Permission issues while using and installing Python packages
  • How to download all packages in nltk in python
  • need an explanation of python packages and modules
  • Distributing Python packages which depend on in-house common convenience libraries
  • Python video converter packages
  • Python — Rpy2 — Can’t import a bunch of packages
  • Problems installing python packages on Mac M1
  • How to view installed Python packages
  • Python dist-packages permissions
  • Installing pip packages in python Docker container
  • Python packages installing in the wrong folder
  • How to import my own Python packages
  • How can I make a Discord bot require x permissions when adding it? Using Python
  • installing python packages on production system(windows) without internet access and no internal pypi server
  • Find all python packages in project
  • How to copy python virtual env accessing global packages to a different machine
  • Installing Packages in Python — Pip/cmd vs Putting File in Lib/site-packages
  • Installing python packages in a virtual environment via bash script and pip
  • Python packages and imports — clarification needed
  • Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc. in Ubuntu
  • How to migrate packages to a new Python installation?
  • Relative import problem with python packages
  • CMake: Check Python3 and Python packages presence
  • Find Python packages on pypi.org importing a certain package
  • pipenv install packages for python is not working
  • Installing Python packages for Visual Studio Code
  • Python — Aren’t packages relative to their current directory?
  • Importing between nested packages in Python 3
  • Python — setuptools — working on two dependent packages (in a single repo?)
  • Should I manually install all my system wide packages after upgrading to Python 3?
  • How to generate md5 signatures when uploading python packages to pypi?
  • Importing wrong packages when calling a python script from another python script via subprocess
  • Vendor namespaces for packages in Python
  • Trouble finding the default packages shipped with Python on Snow Leopard
  • Can distribute setuptools be used to port packages implemented in python 2 to 3
  • python automatic (or dynamic) import classes in packages

More Query from same tag

  • Python, selenium webdriver — I need base class method to return type of its child class. How to achieve it?
  • Python setup.py — install only modifed files
  • How to make a __getitem__ method that allows list[][] indexing (2D)
  • How to create a palette-based PNG with alpha channel?
  • Python requests module does not work for url with path
  • Search for a field in a compound object
  • Illegal instruction (core dumped) while running Dlib Face detection
  • Python — sets .pop() behaviour
  • Multiple events in one TKinter control
  • ValueError: time data » does not match format ‘%d-%m-%Y %H:%M:%S’
  • MemoryError in Python
  • SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService with ChromeDriver and SeleniumGrid through Python
  • Convert large csv to sparse matrix for use in sklearn
  • «Value is Required» on arcpy.CalculateField
  • deepcopy override clarification
  • Parsing a message with various special characters and splitting into a list (re and regex) Python 2.7
  • PyQt5 failing import of QtGui, QtCore and so on
  • What is taking so much memory?
  • Python Default Arguments Evaluation
  • Django allauth joint signup/login view throwing «global name ‘get_form_class’ is not defined»
  • Python Global Hotkey
  • Count how many individual integers there are in a string, Python 3
  • Python nested range function
  • Convert CSV to JSON while dropping certain columns
  • How can you hide letters in a word with an asterisk?
  • Trying to install PyAudio on OS X ( 10.11.3)
  • PyInstaller on Mac: Can run through terminal, can’t run by double clicking
  • Python: Only saving three latest scores
  • Is there any way i can loop through a-z instead of writing multiple for loop stataments?
  • Python convert Private Key to RSA Key
  • Inserting a period after each character in a loop
  • How to execute an arbitrary shell script and pass multiple variables via Python?
  • imapClient error (diff version python and windows)
  • Z3 Python: ordering models and accessing their elements
  • python string assignment

Источник

Читайте также:  Hover event in javascript
Оцените статью