PermissionError: [WinError 5] Access is denied - running pytest after fresh conda install
Environment
# packages in environment at C:\Users\rick\miniconda3\envs\xml:
#
# Name Version Build Channel
pytest 6.2.2 py39haa95532_2
(xml) c:\Users\rick>conda info
active environment : xml
active env location : C:\Users\rick\miniconda3\envs\xml
shell level : 2
user config file : C:\Users\rick\.condarc
populated config files : C:\Users\rick\.condarc
conda version : 4.9.2
conda-build version : not installed
python version : 3.9.2.final.0
virtual packages : __win=0=0
__archspec=1=x86_64
base environment : C:\Users\rick\miniconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\rick\miniconda3\pkgs
C:\Users\rick\.conda\pkgs
C:\Users\rick\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\rick\miniconda3\envs
C:\Users\rick\.conda\envs
C:\Users\rick\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.9.2 requests/2.25.1 CPython/3.9.2 Windows/10 Windows/10.0.18362
administrator : False
netrc file : None
offline mode : False
(xml) c:\Users\rick>pytest
=================================================== test session starts ===================================================
platform win32 -- Python 3.9.2, pytest-6.2.2, py-1.9.0, pluggy-0.13.1
rootdir: c:\Users\rick
collected 0 items / 1 error
========================================================= ERRORS ==========================================================
______________________________________________ ERROR collecting test session ______________________________________________
miniconda3\envs\xml\lib\site-packages\_pytest\runner.py:311: in from_call
result: Optional[TResult] = func()
miniconda3\envs\xml\lib\site-packages\_pytest\runner.py:341: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
miniconda3\envs\xml\lib\site-packages\_pytest\main.py:690: in collect
for direntry in visit(str(argpath), self._recurse):
miniconda3\envs\xml\lib\site-packages\_pytest\pathlib.py:613: in visit
yield from visit(entry.path, recurse)
miniconda3\envs\xml\lib\site-packages\_pytest\pathlib.py:613: in visit
yield from visit(entry.path, recurse)
miniconda3\envs\xml\lib\site-packages\_pytest\pathlib.py:613: in visit
yield from visit(entry.path, recurse)
miniconda3\envs\xml\lib\site-packages\_pytest\pathlib.py:598: in visit
for entry in os.scandir(path):
E PermissionError: [WinError 5] Access is denied: 'c:\\Users\\rick\\AppData\\Local\\Application Data'
================================================= short test summary info =================================================
ERROR - PermissionError: [WinError 5] Access is denied: 'c:\\Users\\rick\\AppData\\Local\\Application Data'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================== 1 error in 2.35s =====================================================
From a Microsoft Technet post
The Application Data folder in that location is not a normal folder. It is a folder Junction and is normally hidden, by default. The only reason that the junction exists is to redirect legacy applications, that are hard coded to look for that folder, to the new location in Windows 7.
Seems odd that pytest would point to a deprecated "folder junction"? How to resolve?
pytest first tries to 'collect' tests - i.e. scans actual folder and its subfolders for python test files containing tests methods.
Looks like you've just installed (conda and) pytest and wanted to just try it, while being located at your os \users\rick folder, containing additional hidden\protected os folders which pytest lack permissions to access. I don't think pytest is deliberately trying to use this deprecated 'folder junction' ,it just happened to sit around your actual working folder at the moment. Running tests for real, you would know where to collect them, i.e. what folder to execute pytest from. For verify install only, run pytest from folder not containing any special os folders.
Collecting tests is also called 'test discovery' and can be parametrized and or configured, pytest docs touching the topic is here https://docs.pytest.org/en/7.0.x/explanation/goodpractices.html#test-discovery
)
Just run "pytest" from the directory you installed it or add it to the environmental variables.
In your example: >cd miniconda3\envs\xml\lib\site-packages_pytest
Related
I have been working on creating custom environments using conda for new projects on my local machine (mac os). Within a project directory I created a new environment using yml file with:
$ conda env create --prefix ./env --file environment.yml
then:
$ conda activate ./env
I am now getting a conda error report every time I open a terminal and I do not understand what is going on. If anyone has any insight on what I broke and how to fix it would be greatly appreciated. I hope I have included enough information here to understand the problem. Here is the error output from terminal:
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 140, in main
return activator_main()
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 1210, in main
print(activator.execute(), end='')
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 178, in execute
return getattr(self, self.command)()
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 152, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 300, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 326, in _build_activate_stack
conda_prompt_modifier = self._prompt_modifier(prefix, conda_default_env)
File "/Users/jrudd/opt/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 691, in _prompt_modifier
return context.env_prompt.format(
KeyError: 'ds-basic'
`$ /Users/jrudd/opt/anaconda3/bin/conda shell.posix activate base`
environment variables:
CIO_TEST=<not set>
CONDA_EXE=/Users/jrudd/opt/anaconda3/bin/conda
CONDA_PYTHON_EXE=/Users/jrudd/opt/anaconda3/bin/python
CONDA_ROOT=/Users/jrudd/opt/anaconda3
CONDA_SHLVL=0
CURL_CA_BUNDLE=<not set>
PATH=/Users/jrudd/opt/anaconda3/bin:/Users/jrudd/opt/anaconda3/condabin:/us
r/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : None
shell level : 0
user config file : /Users/jrudd/.condarc
populated config files : /Users/jrudd/.condarc
conda version : 4.9.2
conda-build version : 3.18.11
python version : 3.8.3.final.0
virtual packages : __osx=10.16=0
__unix=0=0
__archspec=1=x86_64
base environment : /Users/jrudd/opt/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /Users/jrudd/opt/anaconda3/pkgs
/Users/jrudd/.conda/pkgs
envs directories : /Users/jrudd/opt/anaconda3/envs
/Users/jrudd/.conda/envs
platform : osx-64
user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.3 Darwin/20.3.0 OSX/10.16
UID:GID : 501:20
netrc file : /Users/jrudd/.netrc
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
Thanks!
So, I found out that I had screwed up the .condarc config file by changing the base env_prompt to ({ds-basic}). For context, ds-basic is the name of this project environment. Don't ask me why or how I did this because I really have no idea. Was probably something I did during coffee induced haze. I found the .condarc file and edited out the offending code. It had actually broke conda completely and I couldn't even activate the base environment. Once I fixed the .condarc file all was well.
I am trying to create a new environment for Python through Anaconda. But the error keeps coming out saying :
Solving environment: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
OSError: [Errno 122] Disk quota exceeded
I am using the sentence below to create the new environment:
conda create --name cpost python=2.7 numpy=1.9
I understand that this might be related to the working directory, which is really limited in disk quota. So I copied the Anaconda directory fully to a larger disk-quota directory, and tried to create again. The same error came out. As I checked the error information, I noticed the following lines:
$ /nuist/u/home/liangxz/anaconda3/bin/conda create --name cpost python=2.7 numpy=1.9`
environment variables:
CIO_TEST=<not set>
CONDA_ROOT=/nuist/u/home/liangxz/anaconda3
MODULEPATH=/nuist/p/public/app/Modules/modulefiles/app:/nuist/p/public/app/Module
s/modulefiles/compiler:/nuist/p/public/app/Modules/modulefiles/lib:/nu
ist/p/public/app/Modules/modulefiles/mpi
PATH=/nuist/u/home/liangxz/anaconda3/bin:/nuist/p/public/intel/compilers_an
d_libraries_2018.0.128/linux/bin/intel64:/nuist/p/public/intel/compile
rs_and_libraries_2018.0.128/linux/mpi/intel64/bin:/nuist/p/public/pgi/
linux86-64/17.10/bin:/nuist/p/public/pgi/linux86-64/17.10/bin:/opt/xca
t/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/lib64/qt-3.3/bin:
/opt/confluent/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
opt/ibutils/bin:/usr/lpp/mmfs/bin:/root/bin:/opt/pbs/default/bin:/nuis
t/u/home/liangxz/.local/bin:/nuist/u/home/liangxz/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : None
user config file : /nuist/u/home/liangxz/.condarc
populated config files :
conda version : 4.5.4
conda-build version : 3.10.5
python version : 3.6.5.final.0
base environment : /nuist/u/home/liangxz/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/linux-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /nuist/u/home/liangxz/anaconda3/pkgs
/nuist/u/home/liangxz/.conda/pkgs
envs directories : /nuist/u/home/liangxz/anaconda3/envs
/nuist/u/home/liangxz/.conda/envs
platform : linux-64
user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-514.el7.x86_64 centos/7 glibc/2.17
UID:GID : 1135:1135
netrc file : None
offline mode : False
I realized that the "user config file" is /nuist/u/home/liangxz/.condarc, and the "base environment" is "/nuist/u/home/liangxz/anaconda3 (writable)", which means even I copied an anaconda to a larger quota directory, the "writable directory" did not change and remained the small quota directory.(/nuist/u/home/liangxz/ is the small quota directory)
So my question here is how can I change the "base environments" and "envs directories" to the desired larger quota directory? Can I change it directly through some fixings? Or I must install Anaconda again in the bigger directory?
Try following this official anaconda answer that enables adding different directories as your conda cache. I added a different directory where I had more space available and it solved the issue.
I solved this by deleting some of my conda environments. You can find all environments by typing conda env list in the terminal. This will show all environments with their names and paths. Select an environment that you are prepared to remove and type: rm -r <<Path to that environment>>.
Warning: This will delete that environment permanently, so choose wisely.
More details below, but I'm running into the following error when I issue a composer install or composer update command on a project which uses a custom VCS repository for an included project. This is on an IBM i v7r3 system via SSH session. I've run out of ideas on how to troubleshoot further, so here I am. Has anyone ever seen this error or have any ideas on how to troubleshoot further?
Error:
bash-4.4$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 113 installs, 0 updates, 0 removals
- Installing sshUser/myPackage (v1.0.26): Cloning a2db0666b1
[RuntimeException]
Failed to clone gitUser:/opt/git/myPackage.git, git was not found, check that
it is installed and in your PATH env.
Could not load program git:
Dependent module /usr/local/zendphp7/lib/libz.so.1(shr_64.o) could not be loaded.
File /usr/local/zendphp7/lib/libz.so.1 is not an
archive or the file could not be read properly.
System error: Exec format error
I have a remote IBM i server which has two users. The first user "gitUser" is used for my private Git repositories (headless). I then have another user "sshUser" which is used to SSH in with and do my typical work. I have SSH keys configured to simplify connections for both users and the "gitUser" ssh key doesn't require a password, so I can use it for automated scripting.
I have a private VCS repository included in my composer.json file for a project. So long as I have the entry in the "repository" section I'm getting the above error. This occurs even if I'm not requireing a package from the repository.
Repository Entry:
"repositories": [
{
"type": "vcs",
"url": "gitUser:/opt/git/myPackage.git"
}
]
Composer on the IBM i is up to date at 1.7.2.
It's clear the issue lies with git and the inability to find a dependency in libz.so.1.
However, if I follow the chain of dependencies for the version of Git in my path, all the appropriate files exist with adequate permissions:
bash-4.4$ which git
/QOpenSys/pkgs/bin/git
bash-4.4$ dump -X64 -H /QOpenSys/pkgs/bin/git
/QOpenSys/pkgs/bin/git:
***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x000000df 0x0000433f 0x0000009d
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x00000006 0x00044910 0x00000a18 0x000449ad
***Import File Strings***
INDEX PATH BASE MEMBER
0 /QOpenSys/pkgs/lib:/QOpenSys/usr/lib
1 libz.so.1 shr_64.o
2 libiconv.so.2 shr_64.o
3 libcrypto.so.1.0.0 shr_64.o
4 libpthread.a shr_xpg5_64.o
5 libc.a shr_64.o
bash-4.4$
I can confirm there are no permission failures through out all of this. So this doesn't seem to be the result of inadequate permissions. Also, I do not think the issue lies within the user profile gitUser as if I issue a composer install or composer update from another machine (with appropriate keys), everything works flawlessly. So it seems to be specific to the IBM i and the sshUser profile.
I'm starting to think Composer is using a different git executable and the dependencies of that executable do not exist. Though I assume Composer would just use my path.
Note*: I tried specifying my LIBPATH in my ./.profile with the following. But it doesn't seem to make any difference:
LIBPATH=/usr/local/zendphp7/lib
LIBPATH=$LIBPATH:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
export LIBPATH
When echoing:
bash-4.4$ echo $LIBPATH
/usr/local/zendphp7/lib:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
bash-4.4$
If I don't add the above to my ./.profile, then echo $LIBPATH prints a blank line to screen.
Solution:
I just changed the symlink in the ZENDPHP7 directory structure to the repo version. Alternatively you can manipulate your library path, but I couldn't figure out the proper way to do it on IBM i.
bash-4.4$ pwd
/usr/local/zendphp7/lib
bash-4.4$ ln -s /QOpenSys/pkgs/lib/libz.so.1 ./libz.so.1
bash-4.4$ ls -la /usr/local/zendphp7/lib/libz.so.1
lrwxrwxrwx 1 dl 0 56 Oct 11 14:21 /usr/local/zendphp7/lib/libz.so.1 -> /QOpenSys/pkgs/lib/libz.so.1
bash-4.4$
I'm guessing something is off with your path when you do the install. Is it maybe looking at the Zend PHP libraries rather than the expected ones in /usr/lib?
Notice that the errors shows a path of /usr/local/zendphp7/lib/ libz.so.1(shr_64.o) while your git dump instead shows /QOpenSys/pkgs/lib:/QOpenSys/usr/lib.
I'm trying to install the centos netboot install on ppc64le platform but automation installation(kickstart) fails with the following error:
Starting installer, one moment...
find_file: stat /proc/device-tree/chosen/bootpath, No such file or directory
anaconda 21.48.22.56-1 for CentOS AltArch 7 started.
* installation log files are stored in /tmp during the installation
* shell is available on TTY2
* when reporting a bug add logs from /tmp as separate text/plain attachments
Starting automated install..........
Generating updated storage configuration
storage configuration failed: failed to find a suitable stage1 device
================================================================================
================================================================================
Installation
1) [x] Language settings 2) [x] Timezone settings
(English (United States)) (UTC timezone)
3) [x] Installation source 4) [x] Software selection
(http://mirror.centos.org/altar (Custom software selected)
ch/7/os/ppc64le/) 6) [x] Kdump
5) [!] Installation Destination (Kdump is enabled)b | Help: F1
(Error checking storage configu
ration)
7) [x] Network configuration
(Wired (enp0s1) connected)
** (anaconda:1253): WARNING **: Could not open X display
The installation was stopped due to incomplete spokes detected while running in non-interactive cmdline mode. Since there cannot be any questions in cmdline mode, edit your kickstart file and retry installation.
The exact error message is:
The following mandatory spokes are not completed:
Installation Destination.
The installer will now terminate.
[root#llmtul01b qemu]#
And kickstart file looks like:
url --url="http://mirror.centos.org/altarch/7/os/ppc64le/"
install
keyboard us
rootpw --lock --iscrypted locked
timezone --isUtc --nontp UTC
selinux --enforcing
firewall --disabled
network --bootproto=dhcp --device=link --activate --onboot=on
reboot
bootloader --disable
lang en_US
# Repositories to use
repo --name="CentOS" --baseurl=http://mirror.centos.org/altarch/7/os/ppc64le/ --cost=100
## Uncomment for rolling builds
repo --name="Updates" --baseurl=http://mirror.centos.org/altarch/7/updates/ppc64le/ --cost=100
# Disk setup
zerombr
clearpart --all --initlabel
part / --fstype ext4 --size=3000
Looking for the option to select the installation destination through kickstart file.
This problem solved by adding one more partition which is specific for ppc64le pltform.
Update and working kickstart file looks like :
url --url="http://mirror.centos.org/altarch/7/os/ppc64le/"
install
keyboard us
rootpw --lock --iscrypted locked
timezone --isUtc --nontp UTC
selinux --enforcing
firewall --disabled
network --bootproto=dhcp --device=link --activate --onboot=on
reboot
bootloader --disable
lang en_US
# Repositories to use
repo --name="CentOS" --baseurl=http://mirror.centos.org/altarch/7/os/ppc64le/ --cost=100
## Uncomment for rolling builds
repo --name="Updates" --baseurl=http://mirror.centos.org/altarch/7/updates/ppc64le/ --cost=100
# Disk setup
zerombr
clearpart --all --initlabel
part / --fstype ext4 --size=3000
part prepboot --fstype "PPC PReP Boot" --size=10
I installed sp and automap libraries to my R 3.0.1 64-bit under Windows 7 (via install.packages command). Installation of them did not display any error and library(sp) works fine however when I try to execute library(automap) I get the following error:
> library(automap)
Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning messages:
1: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
cannot open compressed file 'C:/Program Files/R/R-3.0.1/library/sp/DESCRIPTION', probable reason 'No such file or directory'
2: In gzfile(file, "rb") :
cannot open compressed file '', probable reason 'Invalid argument'
I looked from the path and indeed there is no DESCRIPTION file (or folder) in that path. However there is just libs folder under which folder x64 and inside it file sp.dll
Any idea what could cause this?
I would definitely try to run R as administrator, both for installing the packages and loading them. This could solve your problem.
This probably has to do with file permissions. When you install the packages as admin in a location where only admin can read/write, running R as a normal user means you do not have the file permissions needed to load the package. Running R as admin will solve this, as admin does have the correct permissions.
Alternatively, you could install your R packages in a location where a normal user has read/write persmissions, e.g. C:/Users/UserName (or something like that, I do not have my windows machine accesible right now).