Jnius installation bug, "Unable to determine JDK_HOME" - python

I tried to install jnius Python module by typing 'pip install jnius' in CMD.
This is the message I got:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\sm\appdata\local\temp\pip-install-vu2sb5\jnius\setup.py", line 111, in <module>
raise Exception('Unable to determine JDK_HOME')
Exception: Unable to determine JDK_HOME
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
c:\users\sm\appdata\local\temp\pip-install-vu2sb5\jnius\
I restarted CMD, but it didn't help.

I have finally resolved it. I have installed Cython before this happened and I installed both Java JDK and JRE after #Chris comment. And I have also added JAVA_HOME and JDK_HOME to system variables.Thank you #Chris, but it didn't resolve problem completely.
Then I got another error message. There was written that I have to install Microsoft Visual C++ Compiler for Python 2.7 from this page:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
After that I tried to install jnius again but the error message said that permission is denied so I ran CMD as administrator and finally installed jnius by typing pip install jnius.
I spent a lot of time to resolve it and hope that it will help everyone with same or similar problem.

I have resolved the problem in windows os.
1st step:
I have installed cython by using pip install cython
C:\Users>pip install cython
Collecting cython
Downloading Cython-0.29.22-cp38-cp38-win_amd64.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 1.3 MB/s
Installing collected packages: cython
Successfully installed cython-0.29.22
2nd step:
I have installed jnius by using pip install pyjnius command
C:\Users>pip install pyjnius
Collecting pyjnius
Downloading pyjnius-1.3.0-cp38-cp38-win_amd64.whl (226 kB)
|████████████████████████████████| 226 kB 3.2 MB/s
Requirement already satisfied: cython in c:\users\sss\appdata\local\programs\python\python38\lib\site-packages (from pyjnius) (0.29.22)
Requirement already satisfied: six>=1.7.0 in c:\users\sss\appdata\local\programs\python\python38\lib\site-packages (from pyjnius) (1.15.0)
Installing collected packages: pyjnius
Successfully installed pyjnius-1.3.0
I hope this solves your problem.

The thing that worked for me was simply adding JAVA_HOME and JDK_HOME variables.

Related

Problem getting python to "find" the pyglet module

I am learning python via a Great Course lecture series, and in the second half of the course need to install the pyglet module. Although I have (apparently) downloaded the module successfully, my PyCharm IDE is not able to locate it, so my .py program with the instruction "import pyglet" generates the following error:
"C:\Users\the_m\PycharmProjects\Program 1\venv\Scripts\python.exe" "C:\Users\the_m\PycharmProjects\Program 1\basketball.py"
Traceback (most recent call last):
File "C:\Users\the_m\PycharmProjects\Program 1\basketball.py", line 1, in <module>
import pyglet
ModuleNotFoundError: No module named 'pyglet'
I am really enjoying the course, and enjoying getting back to coding after a multi-decade hiatus. I am working on a PC. Can anyone suggest a solution?
file locations for python and what I think are the pyglet module are as follows:
C:\Users\the_m>py -m pip --version
pip 23.0 from C:\Users\the_m\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)
C:\Users\the_m>py -m pip install --upgrade pip setuptools wheel
Requirement already satisfied: pip in c:\users\the_m\appdata\local\programs\python\python311\lib\site-packages (23.0)
Requirement already satisfied: setuptools in c:\users\the_m\appdata\local\programs\python\python311\lib\site-packages (65.5.0)
Collecting setuptools
Downloading setuptools-67.2.0-py3-none-any.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 607.4 kB/s eta 0:00:00
Collecting wheel
Downloading wheel-0.38.4-py3-none-any.whl (36 kB)
Installing collected packages: wheel, setuptools
WARNING: The script wheel.exe is installed in 'C:\Users\the_m\AppData\Local\Programs\Python\Python311\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Attempting uninstall: setuptools
Found existing installation: setuptools 65.5.0
Uninstalling setuptools-65.5.0:
Successfully uninstalled setuptools-65.5.0
Successfully installed setuptools-67.2.0 wheel-0.38.4

pip install PyQt6 fails: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

Installing PyQt6 on a Linux Mint box fails with this error:
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
The same error is mentioned in several posts, sometimes for PyQt6, sometimes for other modules. However, none of the proposed solutions (like upgrading pip) seems to work.
Any suggestions on how to figure out what is wrong?
Below are the commands I used. Installation is in a virtual environment (but installing it on the main machine results in the same error).
johan#morla:~/work\> cat /etc/issue
Linux Mint 19 Tara \n \l
johan#morla:~/work\> python --version
Python 3.9.12
johan#morla:~/work\> python -m venv env
johan#morla:~/work\> . env/bin/activate
johan#morla:~/work\> pip list
Package Version
---------- -------
pip 22.1
setuptools 58.1.0
johan#morla:~/work\> pip install PyQt6
Collecting PyQt6
Using cached PyQt6-6.3.0-cp37-abi3-manylinux1_x86_64.whl (7.8 MB)
Collecting PyQt6-sip<14,>=13.2
Using cached PyQt6_sip-13.3.1-cp39-cp39-manylinux1_x86_64.whl (306 kB)
Collecting PyQt6
Using cached PyQt6-6.2.3-cp36-abi3-manylinux1_x86_64.whl (7.7 MB)
Using cached PyQt6-6.2.2-cp36-abi3-manylinux1_x86_64.whl (7.7 MB)
Using cached PyQt6-6.2.1-cp36-abi3-manylinux1_x86_64.whl (7.7 MB)
Using cached PyQt6-6.2.0.tar.gz (1.0 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Querying qmake about your Qt installation...
/usr/bin/qmake -query
Traceback (most recent call last):
File "/home/johan/work/env/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
Based on #eyllanesc's input: the problem is that PyQt6 depends on pyqt6-qt6, and the currently available wheels for pyqt6-qt6 require glibc version 2.28 or greater. As I am using Linux Mint 19 which has glibc 2.27, pip tries to build from source, which fails.
Hint: to check the glibc version, try ldd --version
Solution: upgrade Mint, or wait until #eyllanesc has a solution with an older glibc (or try to compile it myself).
Is there a way to get pip to give a clearer error message?

Rasa installation Requirement Incompatible

I have a laptop with Windows 10 Pro and I'm trying to install Rasa 1.6.0
When I try to run the command pip install rasa==1.6.0 --no-cache-dir, I get the following error:
Collecting sanic~=19.9
Downloading sanic-19.12.4-py3-none-any.whl (73 kB)
|████████████████████████████████| 73 kB 5.1 MB/s
Downloading sanic-19.12.3-py3-none-any.whl (72 kB)
|████████████████████████████████| 72 kB 2.6 MB/s
Downloading sanic-19.12.2-py3-none-any.whl (72 kB)
|████████████████████████████████| 72 kB 5.1 MB/s
Requirement already satisfied: httptools>=0.0.10 in c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages (from sanic~=19.9->rasa=
=1.6.0) (0.1.1)
Requirement already satisfied: aiofiles>=0.3.0 in c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages (from sanic~=19.9->rasa==1
.6.0) (0.6.0)
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\cli\base_command.py", line 224, in _main
status = self.run(options, args)
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\cli\req_command.py", line 180, in wrapper
return func(self, options, args)
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py", line 321, in run
reqs, check_supported_wheels=not options.target_dir
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 122, in resol
ve
requirements, max_rounds=try_to_avoid_resolution_too_deep,
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 445, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 339, in resolve
failure_causes = self._attempt_to_pin_criterion(name, criterion)
File "c:\users\<USER>\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 221, in _attempt_to_pin_c
riterion
raise InconsistentCandidate(candidate, criterion)
pip._vendor.resolvelib.resolvers.InconsistentCandidate: Provided candidate LinkCandidate('https://files.pythonhosted.org/packages/90/54/17f1e496599214de
de67e37e019ce2f210b7861d2dd39b92ac4d3d08e83a/sanic-19.12.2-py3-none-any.whl#sha256=18350ed6e264631260044f6253f139f1ac83c4ce8a0202ec900ec5b50c5370ab (fro
m https://pypi.org/simple/sanic/) (requires-python:>=3.6)') does not satisfy SpecifierRequirement('sanic~=19.9'), SpecifierRequirement('sanic>=0.8.3'),
SpecifierRequirement('sanic~=19.9.0')
Apparently, the library sanic 19.12.2 is being installed and later on the proccess, there's a requirement SpecifierRequirement('sanic~=19.9'), SpecifierRequirement('sanic>=0.8.3'), SpecifierRequirement('sanic~=19.9.0') which should make sanic 19.12.2 compatible. I'm not specifying any library version anywhere, so I'm assuming this is some background requirement from Rasa.
This is the result of pip freeze:
aiofiles==0.6.0
certifi==2020.12.5
click==7.1.2
contextvars==2.4
h11==0.9.0
httpcore==0.11.1
httptools==0.1.1
httpx==0.15.4
idna==3.1
immutables==0.14
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
multidict==4.7.6
Python-dev==2.0.0.dev0
rfc3986==1.4.0
sniffio==1.2.0
websockets==5.0.1
Werkzeug==1.0.1
My Python version is 3.6.5 and pip is on version 20.3.3
Do you have any idea how I can solve this problem ?
Thanks in advance !
_____________________________________________________________________________
EDIT:
Already tried to uninstall python and pip and install them again, but it didn't solve the problem.
Since this is running on an old version of Rasa, I'd suggest doing the installation inside of the virtual environment to make sure that the dependencies you are installing are not clashing with the dependencies that are already installed on your system.
I'd still second the other suggestions of using the newer version of Rasa
(upgrading the project to 2.x) since there were lots of changes and improvements made to the library since the release of Rasa 1.6.0
Solved it. The problem was that I assumed the ~= in sanic~=19.9.0 meant that sanic version should be different from 19.9.0, when in fact it means the version should be the latest version of the package, greater than or equal to 19.9.0, but still in the 19.9.* "range" (according to this accepted answer). And this makes sanic 19.12.2 incompatible.
Tried pip install sanic~=19.9.0 before installing Rasa 1.6.0 and it solved the problem.
You're trying to install an old version of Rasa, one that currently isn't supported anymore and which therefore can have incompatible dependencies. At the time of writing Rasa is at version 2.2 and it's best to install via;
python -m pip install rasa
If you're in a virtualenv when you run this command you'll be sure that it is being installed correctly. In case you're interested there's a youtube installation guide here.
i also faced this issue and found out that you have to install sanic as below:
pip install sanic==19.9.0
The point here is that if you do pip install sanic==19.9 then it doesnt work and again gives the same error that you are facing
once you have installed the "sanic==19.9.0" then you can proceed and install
pip install rasa==1.6.0 --no-cache-dir

pip version error with installed package

I'm attempting to install a package I recently create into a Heroku app. It seems that Heroku uses an older version of pip which prevents my package from installing correctly. I repeated the process with repl.it to see what happens and here is what I get:
Repl.it: Installing fresh packages
Repl.it: zoho_crm
Collecting zoho_crm
Downloading
https://files.pythonhosted.org/packages/8e/73/a1464dd121fec9579c724de6b9b3243ea733fb85d441b928ff467ec1328f/zoho_crm-0.5.tar.gz
Building wheels for collected packages: zoho-crm
Running setup.py bdist_wheel for zoho-crm: started
Running setup.py bdist_wheel for zoho-crm: finished with status 'done'
Stored in directory: /home/runner/.cache/pip/wheels/46/66/f9/c9604984f6670461c451dd9431105760405d06c658d3b44f01
Successfully built zoho-crm
Installing collected packages: zoho-crm
Successfully installed zoho-crm-0.5
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Repl.it: package installation success
Traceback (most recent call last):
File "python", line 1, in <module>
ModuleNotFoundError: No module named 'zoho_crm'
Line 1 of my code (the only line) is import zoho_crm
This is also the same error I get in Heroku.
I have no problems updating pip on my local machine, but the update with these cloud services seems to update but doesn't stick.
Any suggestions?
That version warning is only warning and can be safely ignored now. Your problem has nothing to do with pip, the problem is caused by the broken package zoho_crm — it doesn't contain anything installable, neither python modules nor packages.

PyInstaller won't install, Python 3.6.0a4 and x64 Windows

I have said Python version (from https://www.python.org/downloads/windows/), and x64 Windows 10.
Every time I try to execute "pip install pyinstaller" it crashes with an error:
C:\WINDOWS\system32>pip install pyinstaller
Collecting pyinstaller
Using cached PyInstaller-3.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\users\jskurski\appdata\local\programs\python\python36\lib\site-packages (from pyinstaller)
Collecting pefile (from pyinstaller)
Using cached pefile-2016.3.28.tar.gz
Collecting pypiwin32 (from pyinstaller)
Using cached pypiwin32-219.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\jskurski\AppData\Local\Temp\pip-build-y9lsbd5f\pypiwin32\setup.py", line 121
print "Building pywin32", pywin32_version
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\jskurski\AppData\Local\Temp\pip-build-y9lsbd5f\pypiwin32\
So, for me it seems there is a version msmatch or something. Unofortunately, I can not figure it out myself.
Any suggestions?
Has anybody sucessfully used PyInstaller with latest 3.6 Python on Windows? Or maybe I should downgrade Python to older version?
edit: tested on another PC (same enviroment) and it was the same.
edit2: seems to work on 3.5.2 version, so it's probably a way to go, for now.
pyinstaller needs pypiwin32 module.
when pip tries to install it, it shows an error because there is no pypiwin32 for python3.6
Case is closed for me, as I downgraded to stable 3.5.2. Probably some inconsistency in that alpha release, which caused this. I just wanted to write a simple GUI Windows program, so I will not investigate further.
You have to install manually pywin32 according to your version of python. The following link you can download.
https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/
Once installed pywin32 with your right version of python. Pyinstaller must be installed
As cdarke pointed out, you are running python 2 code on Python 3.
Try this instead:
pip3 install pyinstaller

Categories

Resources