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

Python packages with dependencies #15

Open
alexanderkoller opened this issue Dec 2, 2018 · 3 comments
Open

Python packages with dependencies #15

alexanderkoller opened this issue Dec 2, 2018 · 3 comments

Comments

@alexanderkoller
Copy link

alexanderkoller commented Dec 2, 2018

Hi,

I'm able to run Jython scripts with your plugin, and I am able to download and use simple Python dependencies (such as six) using the jython -> pypackage method.

However, I am struggling with the use of the requests package, which depends on urllib3. It looks like the recursive Python dependency is not found at runtime. I get the exception shown below (with the build.gradle attached below).

Is this a known limitation of gradle-jython, or am I using the plugin wrong?

Best,
Alexander.

hilbert:jython_test koller$ ./gradlew runClient

> Configure project :
Downloading urllib3, version 1.24.1
Skipping existing file urllib3-1.24.1.tar.gz
Downloading requests, version 2.20.1
Skipping existing file requests-2.20.1.tar.gz

> Task :jythonClasses
Skipping existing file urllib3-1.24.1.tar.gz
untar urllib3-1.24.1.tar.gz, urllib3
Skipping existing file requests-2.20.1.tar.gz
untar requests-2.20.1.tar.gz, requests

> Task :runClient FAILED
Traceback (most recent call last):
  File "/Users/koller/Documents/workspace/jython_test/client.py", line 3, in <module>
    import requests
  File "/Users/koller/Documents/workspace/jython_test/build/classes/main/requests/__init__.py", line 43, in <module>
    import urllib3
ImportError: No module named urllib3

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':runClient'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'' finished with non-zero exit value 255

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
2 actionable tasks: 2 executed

Archive.zip

@rzabini
Copy link
Owner

rzabini commented Dec 6, 2018

It seems to me that you are using the plugin correctly.
Can you please try with urllib3 version 1.23 instead of 1.24.1?

@alexanderkoller
Copy link
Author

alexanderkoller commented Dec 7, 2018

New error message, see below.

It seems that now the module chardet is missing. Should the plugin follow the module dependencies and download them along with the ones that are explicitly requested in the build.gradle?

hilbert:jython_test koller$ gradle runClient
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
Downloading urllib3, version 1.23
downloading https://files.pythonhosted.org/packages/3c/d2/dc5471622bd200db1cd9319e02e71bc655e9ea27b8e0ce65fc69de0dac15/urllib3-1.23.tar.gz#sha256=a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf

Download https://files.pythonhosted.org/packages/3c/d2/dc5471622bd200db1cd9319e02e71bc655e9ea27b8e0ce65fc69de0dac15/urllib3-1.23.tar.gz#sha256=a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf
Download https://files.pythonhosted.org/packages/40/35/298c36d839547b50822985a2cf0611b3b978a5ab7a5af5562b8ebe3e1369/requests-2.20.1.tar.gz#sha256=ea881206e59f41dbd0bd445437d792e43906703fff75ca8ff43ccdb11f33f263

> Configure project :
Downloading requests, version 2.20.1
downloading https://files.pythonhosted.org/packages/40/35/298c36d839547b50822985a2cf0611b3b978a5ab7a5af5562b8ebe3e1369/requests-2.20.1.tar.gz#sha256=ea881206e59f41dbd0bd445437d792e43906703fff75ca8ff43ccdb11f33f263

> Task :jythonClasses
Skipping existing file urllib3-1.23.tar.gz
untar urllib3-1.23.tar.gz, urllib3
Skipping existing file requests-2.20.1.tar.gz
untar requests-2.20.1.tar.gz, requests

> Task :runClient
Traceback (most recent call last):
  File "/Users/koller/Downloads/jython_test/client.py", line 2, in <module>
    import requests
  File "/Users/koller/Downloads/jython_test/build/classes/main/requests/__init__.py", line 44, in <module>
    import chardet
ImportError: No module named chardet

> Task :runClient FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':runClient'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'' finished with non-zero exit value 255

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 10s
2 actionable tasks: 2 executed

@rzabini
Copy link
Owner

rzabini commented Dec 7, 2018

Yes, as mentioned in the README:

The plugin does not automatically resolve python dependencies, so these must be declared explicitly

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

No branches or pull requests

2 participants