Pyjnius: Installation for PyJNIus - PermissionError: [WinError 5] Acess denied

Created on 9 Apr 2020  路  15Comments  路  Source: kivy/pyjnius

I have tried the following measures, but error still pops up

Run the cmd in administrator role
Set myself as pycham and python files in administrator role
Used pip install --user PyJNIus
Used python -m pip install --user PyJNIus
Closed Pycham, and run cmd in administrator role
I am already having the highest access right for all files
Can anyone help me out?

C:\WINDOWS\system32>python -m pip install --user PyJNIus
Collecting PyJNIus
  Using cached pyjnius-1.2.1.tar.gz (40 kB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\tom\AppData\Local\Programs\Python\Python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-ueh9n_76\\PyJNIus\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-ueh9n_76\\PyJNIus\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\tom\AppData\Local\Temp\pip-install-ueh9n_76\PyJNIus\pip-egg-info'
         cwd: C:\Users\tom\AppData\Local\Temp\pip-install-ueh9n_76\PyJNIus\
    Complete output (15 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\tom\AppData\Local\Temp\pip-install-ueh9n_76\PyJNIus\setup.py", line 92, in <module>
        compile_native_invocation_handler(*get_possible_homes(PLATFORM))
      File "C:\Users\tom\AppData\Local\Temp\pip-install-ueh9n_76\PyJNIus\setup.py", line 82, in compile_native_invocation_handler
        subprocess.check_call([
      File "C:\Users\tom\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 359, in check_call
        retcode = call(*popenargs, **kwargs)
      File "C:\Users\tom\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 340, in call
        with Popen(*popenargs, **kwargs) as p:
      File "C:\Users\tom\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\Users\tom\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    PermissionError: [WinError 5] Acess denied
awaiting-reply

Most helpful comment

I rewrote env.py -- which does the hunts down the JDK/JRE -- a few months ago, and its an outstanding Pull Request - see https://github.com/kivy/pyjnius/pull/541 - so personally I don't want to debug the older version!

All 15 comments

Hm, do you have javac/ant on the machine? i suspect it's just unable to run a program that is missing (and i've seen windows report that as a permission error in the past, instead of a file not found error).

We'll have to add a python3.8 target to the release, so it'l lbe easier to install there.
edit: actually we have a release for python3.8, but only for amd64 it seems, and you have a 32 bit python.

Hi....

I'm working with Python 3.7 (32-bit) on Windows 10 and I'm seeing the same error after running "pip install pyjnius" in the CMD window. After searching the web, the suggestions that popped up most were about file permissions and executing the command as Administrator. Both of which didn't work.

I also tried the following and it has been to no avail:

1.) Uninstall Python, reinstall Python 3.7.7 (32-bit), then "pip install pyjnius"

2.) Download the actual gz file from https://github.com/kivy/pyjnius/releases/download/1.3.0/pyjnius-1.3.0.tar.gz.
a.) Uncompressed the file.
b.) Opened the CMD window
c.) Went to the downloaded directory, C:UsersHomeDownloadspyjnius-1.3.0.tardistpyjnius-1.3.0pyjnius-1.3.0
d.) Executed the following command: executed the following command: python setup.py

3.) Attempted to install from its git repo.
a.) Tried - pip install git+git://github.com/kivy/pyjnius.git#egg=pyjnius
b.) Tried - pip install git+https://github.com/kivy/pyjnius.git#egg=pyjnius

Any help would be appreciated...

The error is as follows:

Traceback (most recent call last):
File "setup.py", line 95, in
compile_native_invocation_handler(get_possible_homes(PLATFORM))
File "setup.py", line 87, in compile_native_invocation_handler
join('jnius', 'src', 'org', 'jnius', 'NativeInvocationHandler.java')
File "C:UsersHomeAppDataLocalProgramsPythonPython37-32libsubprocess.py", line 358, in check_call
retcode = call(
popenargs, *kwargs)
File "C:UsersHomeAppDataLocalProgramsPythonPython37-32libsubprocess.py", line 339, in call
with Popen(
popenargs, **kwargs) as p:
File "C:UsersHomeAppDataLocalProgramsPythonPython37-32libsubprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:UsersHomeAppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1207, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied

this error can also be reported when the program we try to run is not found, here the setup.py tries to run ant/javac to build some java code, so i think it fails for not finding it in the path, can you check that you have both?

But i wonder why you are using a 32 bit python? we only provide a wheel for the 64bit version, maybe we could provide one for the 32 bit version, but it's a bit of work, and at this point it really feels like people should have moved from that, can't yo install the 64 bit release of python? If you do that, pyjnius should install without needing any compilation.

Hi Gabriel,

Thanks for the feedback. I'll look into installing the 64-bit version of Python, then pyjnius. If all works fine, I'll drop a note here.

Did it help?

Hi @tshirtman

I went ahead and installed the 64-bit Python version and installed the pyjnius module with no issues.

I did ask myself, "Why are you using the 32-bit version?" and I couldn't really come up with a good answer. So, I did an inventory and installed the modules that I have in 32-bit, into the 64-bit and after updating the PATH, each of my .py files are executing fine.

Thanks and I appreciate the follow-up...

:)

great!

I started to have a look at building for windows 32 bit btw (#536), and it seems we have a couple things to fix, so maybe that'll come, but i don't know when, so good thing you could move on :D.

Hello,
this might be worth noting.
I do not have python installed as a 32 bit app, although i suspect this has something to do with a 32 bit python being installed under appdata (although, i dont have any recollection that i installed it as a 32 bit application).
I had to actually open up a command prompt elevated, and traverse to the python folder under program files and run the command
.python.exe -m pip install pyjnius
to properly install pyjnius.

Not sure how useful/useless this is.

I ran into this issue today. I was initially using Python 3.8 32-bit (no idea why I had 32-bit installed instead of 64-bit) and then saw this issue and upgraded to python 3.9 64-bit. After upgrading, I still ran into the same issue when compiling. Tried with elevated command prompt, going to the actual install directory for python and running the command as mentioned in the previous comment, but I still could not get it to work.

I then took a look at pypi and saw that wheels are provided for python 3.8 64-bit so I switched to that version and got pyjnius to install.

It would be nice if this could be made clearer in the documentation so that the installation process is easier for new users. Especially since it doesn't seem like pyjnius can be installed with python 3.9 on Windows yet.

So is it the case that you have a JRE rather than a JDK?
Is javac on your path?

I have OpenJDK 11 (jdk-11.0.8.10-hotspot) installed and yes, javac is on my path.

So 3.9 is now on the Continuous Deployment github action script (as of 4 days ago) - see https://github.com/kivy/pyjnius/blob/master/.github/workflows/create.yml#L13 - so I think that the next release will have a binary distribution for Python 3.9 64bit on Windows.

That's good to hear!

Any idea why there are issues when installing through pip and no pre-built packages are available? I took a quick look at the setup.py script as well as the env.py script to see how paths are determined and AFAICT there should have been no permission errors (or file not found errors) since the path to javac should have been resolved correctly.

I rewrote env.py -- which does the hunts down the JDK/JRE -- a few months ago, and its an outstanding Pull Request - see https://github.com/kivy/pyjnius/pull/541 - so personally I don't want to debug the older version!

I have the same problem but I could install it using Anaconda Anaconda on Ubuntu App in windows 10 >> because Anaconda itself is not easy to deal with

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmacdonald picture cmacdonald  路  20Comments

tshirtman picture tshirtman  路  23Comments

ignertic picture ignertic  路  4Comments

cthoyt picture cthoyt  路  11Comments

Thrameos picture Thrameos  路  27Comments