Skip to content
New issue

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

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

Closed
tom19952000 opened this issue Apr 9, 2020 · 15 comments
Closed

Comments

@tom19952000
Copy link

tom19952000 commented Apr 9, 2020

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
@tshirtman
Copy link
Member

tshirtman commented Apr 19, 2020

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.

@KCPKCP
Copy link

KCPKCP commented May 6, 2020

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:\Users\Home\Downloads\pyjnius-1.3.0.tar\dist\pyjnius-1.3.0\pyjnius-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:\Users\Home\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 358, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Home\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Home\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 800, in init
restore_signals, start_new_session)
File "C:\Users\Home\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied

@tshirtman
Copy link
Member

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.

@KCPKCP
Copy link

KCPKCP commented May 7, 2020

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.

@tshirtman
Copy link
Member

Did it help?

@KCPKCP
Copy link

KCPKCP commented May 10, 2020

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...

:)

@tshirtman
Copy link
Member

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.

@narsei
Copy link

narsei commented Jun 1, 2020

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.

@vari
Copy link

vari commented Oct 26, 2020

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.

@cmacdonald
Copy link
Contributor

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

@vari
Copy link

vari commented Oct 26, 2020

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

@cmacdonald
Copy link
Contributor

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.

@vari
Copy link

vari commented Oct 26, 2020

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.

@cmacdonald
Copy link
Contributor

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

@ABDULAZIZALQATAN
Copy link

ABDULAZIZALQATAN commented Dec 14, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants