Lack of permissions in Windows - python-3.x

I created C:/Users/homedir/Documents/Python. Windows automatically
puts that in OneDrive's path. Is this causing the permission errors?
d#LAPTOP-M0R87BQ6 MINGW64 ~/OneDrive/Documents/Python/twilio-python-main (main)
$ python3 setup.py install
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: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-9920.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\Lib\site-packages\
Is the only problem I need to create the directory (or modify setup.py to install in Python's path elsewhere)?
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.
I am the Admin for this machine, I'm in the Group Administrators. There is no higher root on my machine. I opened a PowerShell as an Admin and ran the python interpreter. Still insufficient permissions. Looking at Windows Explorer I am Owner of all the files.
The error says: "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 PYTHON PATH environment variable."
For information on other options, you may wish to consult the
documentation at:
https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.

in cmd windows try taking ownership of WindowsApps folder and ensure the properties are inherited by its subfolders
takeown /f \"C:\Program Files\WindowsApps" && icacls \"C:\Program Files\WindowsApps" /grant administrators:F

Related

Installing software on server machine - the install process wants to modify root folders which I cannot access

I'm configuring software on my first web server, so I am not totally familiar with how everything works, but here is the basic problem:
I have purchased hosting on a web server that runs on CentOS. I have been able to install postgreSQL via an install process that the hoster provides, so that my database will be local only to my home folder. That is working fine.
However, I am trying to install a postgreSQL extension called PostGIS. I have tried to compile it from source on my web server, but it now requires an additional library called GEOS. I downloaded the library from http://download/osgeo.org/geos/geos-3.6.2.tar.bz2, extracted it, and used make install to run it.
Now the problem is that it fails due to this error:
/bin/mkdir: cannot create directory /usr/local/include/geos: Permission Denied
It's not really a surprise, because it is trying to make a new directory in the system root folders, rather than within my personal home folder, which is the only one I have access to. I can't think of any other way around this. Am I just unable to install this library? Or can I "trick" it somehow into installing in in my home directory, where I have full admin rights?
I think You need to execute a command with root user privileges.
Because, make install command need root user privileges.
Like,
sudo make install
or with root user. Like,
sudo su
make install

NVM issue after recovery/reinstall ubuntu

Over the weekend I had to performed a fresh install on Ubuntu on my laptop.
I was restoring my files from my backup, but I used the wrong username.
I've tried to change the username and the $PATH but I'm still getting the same error
t0m#asuntu:~$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
=> Downloading nvm from git to '/home/ubut0m/.nvm'
=> mkdir: cannot create directory ‘/home/ubut0m’: Permission denied
ls: cannot access '/home/ubut0m/.nvm': No such file or directory
fatal: could not create leading directories of '/home/ubut0m/.nvm': Permission denied
Failed to clone nvm repo. Please report this!
t0m#asuntu:~$ vim .bashrc
t0m#asuntu:~$
I've tried removing and reinstalling everthing (NPM, Node, NVM), but don't know why I can't get the script to work. Any help is appreciated.
Check that you're $HOME environment variable matches that of the user you are currently running as, which you can check with whoami. Sometimes, some tools that elevate privileges (such as sudo) preserve the old user's home directory environment variable while running as the new user.
If that's not the problem, check that your home directory exists and has the correct permissions. Usually, if that's the problem, all sorts of other issues pop up (but I can understand a tendency to ignore such things on a newly restored machine).
If it's neither of those things, you can try making sure that you are in your home directory when running the wget | bash command although that really shouldn't be necessary (and if that turns out to be the issue, I would definitely file a bug with nvm about it).

Workspace Settings permission denied

I'm running Ubuntu 12.04LTS.
Have unpacked Visual Studio Code in a folder owned by my user id. All vscode files are owned by my user id (user and group).
Have Node.js, npm, typescript installed via apt-get (and npm).
Visual Studio code runs fine, however File->Preferences->Workspace Settings gives this error:
Unable to create 'vscode/settings.json' (Error: EACCES: permission denied, mkdir '/.vscode').
Any ideas on how to resolve this? Where is it trying to do the mkdir?
Thanks,
Bob Wirka
UPDATE: Sudo'd mkdir "/.vscode" (literally at the root level), and chown'd it recursively to my user and group. Voila! Now I can edit the settings.
So, is there a way to tell Visual Studio Code that it shouldn't be trying to use the root folder?
Mentioned in the update by the OP but thought I'll mention it explicitly. You need to change the permissions for the folder. The following command will change the owner of the directory so that you can open it without needing root privileges.
$ sudo chown <user-name> -R <directory-name>
I had same issue on my osx. I was able to solve this issue by change the permission to read and write in project folder.
Simply type
sudo chmod 777 -R <your_app_name_directory>.
This will give all permissions to all users, groups and others for read, write, execute.
-R gives recursively permissions to all nested files folders inside your directory.
If -R is not given then it gives permissions to current directory only, not to other directories inside.
Change the permissions to your folder
sudo chmod ugo+rwx your_folder

Adding binaries to the 'bin' catalog

When I'm trying to add 'phantomjs' binary to the 'bin' folder (/usr/bin) on Mac OSX, the following error occurs:
Oskars-MacBook-Pro:bin oskarszura$ mv phantomjs ../../../../usr/local/bin/
mv: rename phantomjs to ../../../../usr/local/bin/phantomjs: Permission denied
i assume that I shouldn't change this catalog's permissions. How should I add binaries on Mac OSX ?
You need administrator (also called root) rights to fiddle with the system folders.
See the sudo command how gain those privileges for a single command.
Also, instead of using that relative path to /usr/local/bin, why not simple use the full path of just /usr/local/bin?

Can't run demos of Qt

I just installed Qt. I tried to run some demos but I cannot run any, this is the message:
Cannot create file /opt/QtSDK/Demos/4.7/chip/chip.pro.user: Permission
denied
To avoid this in the future, how can I set permissions to any program I install?
I'm new to using linux, I'm using Ubuntu 12.04.
Either don't install the SDK in a root-access directory, or run the program (qtcreator, etc...)with root privileges. I would choose the former solution. I generally use a folder in my home directory.
Qt SDK is standalone, so you can copy or move the whole folder to a new location which doesn't requires root privileges.

Resources