Giter VIP home page Giter VIP logo

gradle-python-envs's Introduction

official JetBrains project

Gradle Python Envs Plugin

Gradle plugin to create Python envs.

This plugin is based on gradle-miniconda-plugin, but in addition to creating Conda envs it provides:

  1. A convenient DSL to specify target Python environments
  2. Creating Python envs for Unix with python-build for Unix
    N.B.: Common build problems article from pyenv
  3. Creating Python envs for Windows by installing msi or exe from python.org.
    N.B.: Windows UAC should be switched off, otherwise - use Python from zip
  4. Both Anaconda and Miniconda support (32 and 64 bit versions)
  5. Creating Conda envrionments, conda package installation support
  6. Creating Jython environments
  7. Creating PyPy environments (only Unix is supported, by default pypy2.7-5.8.0 version is used)
  8. Creating IronPython environments (only Windows is supported, by default 2.7.9 version is used)
  9. Virtualenv creation from any python environment created
  10. Python from zip creation: downloading archive from specified url, unpacking and preparing to work with
  11. Package installation for any environment or virtualenv with specified install options

Usage

Apply the plugin to your project following https://plugins.gradle.org/plugin/com.jetbrains.python.envs, and configure the associated extension:

envs {
  bootstrapDirectory = new File(buildDir, 'bootstrap')
  envsDirectory = new File(buildDir, 'envs')
  
  // Download python zips when Windows is used from https://repository.net/%archieveName%,
  // where {archieveName} is python-{version}-{architecture}.zip.
  // For example, for the 64 bit version of Python 3.7.2 the archive name will be python-3.7.2-64.zip
  zipRepository = new URL("https://repository.net/")
  shouldUseZipsFromRepository = Os.isFamily(Os.FAMILY_WINDOWS)
  
  // by default if architecture isn't specified - 64 bit one is used
  // _64Bits = true
  
  // by default pipInstallOptions equals to "--trusted-host pypi.python.org" 
  // to fix CERTIFICATE_VERIFY_FAILED ssl error
  // pipInstallOptions = "--trusted-host pypi.python.org"
  
  //python "envName", "version", [<packages>]
  python "python35_64", "3.5.3", ["django==1.9"]
  //python "envName", "version", "architecture", [<packages>]
  python "python36_32", "3.6.2", "32", ["django==1.10"]
  //python "envName", "version", "architecture", [<packages>], patchUri
  python "python310_64", "3.10.0", "64", [], "file://path/to/a.patch"
  //virtualenv "virtualEnvName", "sourceEnvName", [<packages>]
  virtualenv "envPython35", "python35_64", ["pytest"]
  virtualenv "envPython36", "python36_32", ["behave", "requests"]

  //conda "envName", "version", "architecture"
  conda "Miniconda3", "Miniconda3-latest", "64"
  //conda "envName", "version", [<packages>]
  conda "Anaconda2", "Anaconda2-4.4.0", [condaPackage("PyQt")]
  //conda "envName", "version", "architecture", [<packages>]
  conda "Anaconda3", "Anaconda3-4.4.0", "64", ["django==1.8"]
  
  //condaenv "envName", "version", [<packages>]
  // Here will be created additional "Miniconda2-latest" 
  // (or another one specified in condaDefaultVersion value) 
  // conda interpreter to be bootstraped
  condaenv "pyqt_env", "2.7", [condaPackage("pyqt")]
  //condaenv "envName", "version", "sourceEnvName", [<packages>]
  condaenv "django19", "2.7", "Miniconda3", ["django==1.9"]
  condaenv "conda34", "3.4", "Miniconda3", ["ipython==2.1", "django==1.6", "behave", "jinja2", "tox==2.0"]

  if (Os.isFamily(Os.FAMILY_WINDOWS)) {
    // This links are used for envs like tox; *nix envs have such links already
    link "bin/python2.7.exe", "bin/python.exe", new File(envsDirectory, "django19")
    link "bin/python3.4.exe", "bin/python.exe", new File(envsDirectory, "conda34")
  }

  //jython "envName", [<packages>]
  jython "jython"
  virtualenv "envJython", "jython", ["django==1.8"]
  
  if (Os.isFamily(Os.FAMILY_UNIX)) {
    //pypy "envName", [<packages>]
    pypy "pypy2", ["django"]
    virtualenv "envPypy2", "pypy2", ["pytest"]
    //pypy "envName", "version", [<packages>]
    //version should be in accordance with python-build
    pypy "pypy3", "pypy3.5-5.8.0", ["nose"]
    virtualenv "envPypy3", "pypy3", ["django"]    
  }
  
  if (Os.isFamily(Os.FAMILY_WINDOWS)) {
    //ironpython "envName", [<packages>]
    ironpython "ironpython64", ["requests"]
    //ironpython "envName", "architecture", [<packages>]
    ironpython "ironpython32", "32", ["requests"]
    // ironpython doesn't support virtualenvs at all
  }
}

Then invoke the build_envs task.

This will download and install specified python's interpreters (python, anaconda and miniconda, jython, pypy, ironpython) to buildDir/bootstrap.

Then it will create several conda and virtual envs in buildDir/envs.

Libraries listed will be installed correspondingly. Packages in list are installed with pip install command. If the function condaPackage() was called for package name, it will be installed with conda install command. It enables to install, for example, PyQt in env.

License

The code is licensed under the Apache 2.0 License. See the included LICENSE file for details.

gradle-python-envs's People

Contributors

anuraaga avatar arostovsky avatar avli avatar elizaveta239 avatar peterlindsten avatar throwable-one avatar trofimander avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gradle-python-envs's Issues

Execution failed for task ':install_python_build' due to java.io.FileNotFoundException (when running 'clean test')

Execution failed for task ':install_python_build' > java.io.FileNotFoundException: /path/to/module/build/pyenv.zip (No such file or directory)

Description:

I've got a python sub-module on a project managed by gradle. The goal is to run python tests (via command: python setup.py test) on a python environment managed by the gradle-python-envs plugin.
This happens it 2 phases:

  1. run the build_envs task
  2. source the generated python virtual environment and run python command.

The corresponding build.gradle file that configures the above actions is on this gist: https://gist.github.com/gregoavg/c736105c8d715a8b5a3036b74907fd09

When:

Running the tests from the project root via gradle wrapper with the following:
./gradlew clean test
Or even building the whole project (or directly the submodule) with:
./gradlew clean test build

Expected:

Clean task should delete the buildDir and the build_envs task that is being invoked
via the test one, should recreate the build directory.
This will allow the install_python_build to use the buildDir and download the pyenv sources.

Result:

The buildDir directory get's deleted normally by the clean task. The install_python_build get's invoked and tries to create a file on the path of the build directory, that does not exist anymore.

The build fails with the following stacktrace:

Caused by: : java.io.FileNotFoundException: /path/to/build/pyenv.zip (No such file or directory)
        at org.apache.tools.ant.taskdefs.Get.execute(Get.java:151)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:78)
        at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:103)
        at com.jetbrains.python.envs.PythonEnvsPlugin$_createInstallPythonBuildTask_closure2$_closure16$_closure17.doCall(PythonEnvsPlugin.groovy:81)
        at com.jetbrains.python.envs.PythonEnvsPlugin$_createInstallPythonBuildTask_closure2$_closure16.doCall(PythonEnvsPlugin.groovy:79)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:656)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:637)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.java:115)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.java:109)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:90)
        ... 70 more
Caused by: java.io.FileNotFoundException: /path/to/build/pyenv.zip (No such file or directory)
        at org.apache.tools.ant.taskdefs.Get$GetThread.downloadFile(Get.java:815)
        at org.apache.tools.ant.taskdefs.Get$GetThread.get(Get.java:647)
        at org.apache.tools.ant.taskdefs.Get$GetThread.run(Get.java:631)

The responsible line on the plugin in this:

new File(project.buildDir, "pyenv.zip").with { pyenvZip ->

Proposed solution:

Ensure that the buildDir is present (if it's not, execute a command to create it), before the doLast closure of the task is being executed.
This could be added as a doFirst part of the task.

OFC, I will be more that happy to provide a PR with a proposed solution for this issue, if you consider this action as a helpful addition for the plugin needs.

Merge with gradle-miniconda-plugin?

Hi @Traff, I'm the author of gradle-miniconda-plugin. The changes/enhancements you've made seem pretty cool, and I'd have accepted PRs for them to the original project. While you're obviously within your legal rights to fork or copy the code, I'd appreciate if you could contribute your changes back and we could build a Python + Gradle community together.

Thanks!

"IOError: [Errno 2] No such file or directory" creating environment.

Issuing command gradle build_envs:

Initial bootstrap, miniconda gets installed, after that the environment I've defined in the build.gradle crashes. With the error:

IOError: [Errno 2] No such file or directory: u'/vagrant/project-test1/build/bootstrap/miniconda_latest_64/pkgs/openssl-1.0.2l-0/info/index.json'

Build script

plugins {
  id "com.jetbrains.python.envs" version "0.0.18"
}

envs {
  bootstrapDirectory = new File(buildDir, 'bootstrap')
  envsDirectory = new File(buildDir, 'envs')
    conda "project-test1", "3.5", "64", ["pycodestyle==2.3.1", "pylint==1.7.2", "pytest-cov==2.5.1"     ]
}

task coverage() {
    doLast() {
        println 'coverage task'
    }
}

See full log:

Bootstraping to /vagrant/project-test1/build/bootstrap/miniconda_latest_64
PREFIX=/vagrant/project-test1/build/bootstrap/miniconda_latest_64
installing: python-2.7.13-0 ...
installing: asn1crypto-0.22.0-py27_0 ...
installing: cffi-1.10.0-py27_0 ...
installing: conda-env-2.6.0-0 ...
installing: cryptography-1.8.1-py27_0 ...
installing: enum34-1.1.6-py27_0 ...
installing: idna-2.5-py27_0 ...
installing: ipaddress-1.0.18-py27_0 ...
installing: libffi-3.2.1-1 ...
installing: openssl-1.0.2l-0 ...
installing: packaging-16.8-py27_0 ...
installing: pycosat-0.6.2-py27_0 ...
installing: pycparser-2.17-py27_0 ...
installing: pyopenssl-17.0.0-py27_0 ...
installing: pyparsing-2.1.4-py27_0 ...
installing: readline-6.2-2 ...
installing: requests-2.14.2-py27_0 ...
installing: ruamel_yaml-0.11.14-py27_1 ...
installing: setuptools-27.2.0-py27_0 ...
installing: six-1.10.0-py27_0 ...
installing: sqlite-3.13.0-0 ...
installing: tk-8.5.18-0 ...
installing: yaml-0.1.6-0 ...
installing: zlib-1.2.8-3 ...
installing: conda-4.3.21-py27_0 ...
installing: pip-9.0.1-py27_1 ...
installing: wheel-0.29.0-py27_0 ...
Python 2.7.13 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
Installing packages via conda: []

> Task :Create conda env 'project-test1'
Creating condaenv 'project-test1' at /vagrant/project-test1/build/envs/project-test1 directory
Fetching package metadata .........
Solving package specifications: . 0s]

Package plan for installation in environment /vagrant/project-test1/build/envs/project-test1:

The following NEW packages will be INSTALLED:

    certifi:    2016.2.28-py35_0
    openssl:    1.0.2l-0        
    pip:        9.0.1-py35_1    
    python:     3.5.4-0         
    readline:   6.2-2           
    setuptools: 36.4.0-py35_1   
    sqlite:     3.13.0-0        
    tk:         8.5.18-0        
    wheel:      0.29.0-py35_0   
    xz:         5.2.3-0         
    zlib:       1.2.11-0        

openssl-1.0.2l  64% |####################           | ETA:  0:00:01   1.02 MB/s                                                                                                                openssl-1.0.2l 100% |###############################| Time: 0:00:05 635.30 kB/s
readline-6.2-2  66% |####################           | Time: 0:00:00   2.37 MB/s                                                                                                               lreadline-6.2-2 100% |###############################| Time: 0:00:00   2.53 MB/s
sqlite-3.13.0-  14% |####                           | Time: 0:00:00   2.31 MB/s                                                                                                                sqlite-3.13.0-  34% |##########                     | Time: 0:00:00   2.76 MB/s                                                                                                                sqlite-3.13.0-  54% |################               | Time: 0:00:00   2.94 MB/s                                                                                                                sqlite-3.13.0-  74% |#######################        | Time: 0:00:01   3.06 MB/s                                                                                                                sqlite-3.13.0-  94% |#############################  | Time: 0:00:01   3.11 MB/s                                                                                                               isqlite-3.13.0- 100% |###############################| Time: 0:00:01   3.10 MB/s
tk-8.5.18-0.ta  30% |#########                      | Time: 0:00:00   3.37 MB/s                                                                                                               %tk-8.5.18-0.ta  72% |######################         | Time: 0:00:00   3.31 MB/s                                                                                                               #tk-8.5.18-0.ta 100% |###############################| Time: 0:00:00   3.25 MB/s
xz-5.2.3-0.tar  38% |###########                    | Time: 0:00:00   2.53 MB/s                                                                                                                xz-5.2.3-0.tar 100% |###############################| Time: 0:00:00   1.83 MB/s
zlib-1.2.11-0. 100% |###############################| Time: 0:00:00   2.14 MB/s
python-3.5.4-0   1% |                               | Time: 0:00:00   2.46 MB/s                                                                                                               0python-3.5.4-0  11% |###                            | Time: 0:00:00   2.92 MB/s                                                                                                                python-3.5.4-0  16% |#####                          | Time: 0:00:00   2.84 MB/s                                                                                                                python-3.5.4-0  21% |######                         | Time: 0:00:01   2.81 MB/s                                                                                                                python-3.5.4-0  26% |########                       | Time: 0:00:01   2.73 MB/s                                                                                                               0python-3.5.4-0  36% |###########                    | Time: 0:00:02   2.78 MB/s                                                                                                                python-3.5.4-0  41% |############                   | Time: 0:00:02   2.82 MB/s                                                                                                               #python-3.5.4-0  46% |##############                 | Time: 0:00:02   2.84 MB/s                                                                                                                python-3.5.4-0  51% |###############                | Time: 0:00:02   2.87 MB/s                                                                                                               0python-3.5.4-0  61% |###################            | Time: 0:00:03   2.92 MB/s                                                                                                                python-3.5.4-0  66% |####################           | Time: 0:00:03   2.94 MB/s                                                                                                               #python-3.5.4-0  71% |######################         | Time: 0:00:04   2.93 MB/s                                                                                                                python-3.5.4-0  76% |#######################        | Time: 0:00:04   2.94 MB/s                                                                                                               0python-3.5.4-0  86% |##########################     | Time: 0:00:05   2.82 MB/s                                                                                                                python-3.5.4-0  91% |############################   | Time: 0:00:05   2.73 MB/s                                                                                                               #python-3.5.4-0  96% |#############################  | Time: 0:00:05   2.74 MB/s                                                                                                               #python-3.5.4-0 100% |###############################| Time: 0:00:06   2.75 MB/s
certifi-2016.2 100% |###############################| Time: 0:00:00   2.79 MB/s
wheel-0.29.0-p 100% |###############################| Time: 0:00:00   2.63 MB/s
setuptools-36. 100% |###############################| Time: 0:00:00   3.23 MB/s
pip-9.0.1-py35   4% |#                              | Time: 0:00:00   2.80 MB/s                                                                                                               Mpip-9.0.1-py35  50% |###############                | Time: 0:00:00   3.26 MB/s                                                                                                               ypip-9.0.1-py35  97% |#############################  | Time: 0:00:00   3.25 MB/s                                                                                                               An unexpected error has occurred.m 31s]
Please consider posting the following information to the
conda GitHub issue tracker at:

    https://github.com/conda/conda/issues



Current conda install:

               platform : linux-64
          conda version : 4.3.21
       conda is private : False
      conda-env version : 4.3.21
    conda-build version : not installed
         python version : 2.7.13.final.0
       requests version : 2.14.2
       root environment : /vagrant/project-test1/build/bootstrap/miniconda_latest_64  (writable)
    default environment : /vagrant/project-test1/build/bootstrap/miniconda_latest_64
       envs directories : /vagrant/project-test1/build/bootstrap/miniconda_latest_64/envs
                          /home/vagrant/.conda/envs
          package cache : /vagrant/project-test1/build/bootstrap/miniconda_latest_64/pkgs
                          /home/vagrant/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.21 requests/2.14.2 CPython/2.7.13 Linux/4.4.0-31-generic debian/stretch/sid glibc/2.23    
                UID:GID : 1000:1000

`$ /vagrant/project-test1/build/bootstrap/miniconda_latest_64/bin/conda create -p /vagrant/project-test1/build/envs/project-test1 -y python=3.5`




    Traceback (most recent call last):
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/exceptions.py", line 632, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main
        exit_code = args.func(args, p)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/cli/main_create.py", line 68, in execute
        install(args, parser, 'create')
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/cli/install.py", line 357, in install
        execute_actions(actions, index, verbose=not context.quiet)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/plan.py", line 830, in execute_actions
        execute_instructions(plan, index, verbose)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/instructions.py", line 247, in execute_instructions
        cmd(state, arg)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/instructions.py", line 107, in UNLINKLINKTRANSACTION_CMD
        txn = UnlinkLinkTransaction.create_from_dists(index, prefix, unlink_dists, link_dists)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/core/link.py", line 125, in create_from_dists
        for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link))
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/core/link.py", line 125, in <genexpr>
        for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link))
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/gateways/disk/read.py", line 81, in read_package_info
        index_json_record = read_index_json(extracted_package_directory)
      File "/vagrant/project-test1/build/bootstrap/miniconda_latest_64/lib/python2.7/site-packages/conda/gateways/disk/read.py", line 100, in read_index_json
        with open(join(extracted_package_directory, 'info', 'index.json')) as fi:
    IOError: [Errno 2] No such file or directory: u'/vagrant/project-test1/build/bootstrap/miniconda_latest_64/pkgs/openssl-1.0.2l-0/info/index.json'

pip-9.0.1-py35 100% |###############################| Time: 0:00:00   3.25 MB/s


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Create conda env 'project-test1''.
> Process 'command '/vagrant/project-test1/build/bootstrap/miniconda_latest_64/bin/conda'' finished with non-zero exit value 1

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

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

BUILD FAILED in 1m 33s
2 actionable tasks: 2 executed

Gradle 4.4 generates deprecation warning

When I run a basic setup of this plugin (which seem to work great by the way) I get this warning in gradle 4.4
The task name 'Bootstrap CONDA 'Miniconda2'' contains at least one of the following characters: [ , /, \, :, <, >, ", ?, *, |]. This has been deprecated and is scheduled to be removed in Gradle 5.0.

I'm not seeing any of those characters in the name, but perhaps it treats ' as " in lower case? or perhaps the first character is a space

gradlew -version for completeness

$ gw -version

------------------------------------------------------------
Gradle 4.4
------------------------------------------------------------

Build time:   2017-12-06 09:05:06 UTC
Revision:     cf7821a6f79f8e2a598df21780e3ff7ce8db2b82

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_151 (Oracle Corporation 25.151-b12)
OS:           Windows 10 10.0 amd64

build.gradle excerpt

plugins {
  id "com.jetbrains.python.envs" version "0.0.21"
}
envs {
  bootstrapDirectory = new File(buildDir, 'bootstrap')
  envsDirectory = new File(buildDir, 'envs')

  conda "Miniconda2", "Miniconda2-latest", "64", ['pylint']
}

Update environment dependencies upon change

When adding a new dependency to a Python virtual machine it is necessary to delete the virtual machine manually in order to rebuild it. Would it make sense to have the build_envs functions run and update dependencies when those dependencies are detected to have changed?

No module named pip

My configuration is

envs {
    bootstrapDirectory = new File(buildDir, 'bootstrap')
    envsDirectory = new File(buildDir, 'envs')
  
    // Download python zips when Windows is used from https://repository.net/%archieveName%,
    // where {archieveName} is python-{version}-{architecture}.zip.
    // For example, for the 64 bit version of Python 3.7.2 the archive name will be python-3.7.2-64.zip
    zipRepository = new URL("https://www.python.org/ftp/python/3.11.0/")
    shouldUseZipsFromRepository = Os.isFamily(Os.FAMILY_WINDOWS)
 
    //python "envName", "version", "architecture", [<packages>]
    python "python311_64", "3.11.0", "embed-amd64"

    //virtualenv "virtualEnvName", "sourceEnvName", [<packages>]
    virtualenv "envPython311", "python311_64", ["python-keycloak"]
}

and I get the following error

> Task :Bootstrap_PYTHON_'python311_64'_from_archive
Downloading python-3.11.0-embed-amd64.zip archive from https://www.python.org/ftp/python/3.11.0/python-3.11.0-embed-amd64.zip
Unzipping downloaded python-3.11.0-embed-amd64.zip archive
Downloading & installing pip and setuptools
Collecting pip
  Using cached pip-23.0-py3-none-any.whl (2.1 MB)
Collecting setuptools
  Using cached setuptools-67.2.0-py3-none-any.whl (1.1 MB)
Collecting wheel
  Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Installing collected packages: wheel, setuptools, pip
Successfully installed pip-23.0 setuptools-67.2.0 wheel-0.38.4
Force upgrade pip and setuptools
Executing 'C:\cog\git\at\keycloak\install\build\bootstrap\python311_64\python.exe -m pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade --force pip setuptools'

> Task :Bootstrap_PYTHON_'python311_64'_from_archive FAILED
1 actionable task: 1 executed
<-------------> 0% WAITING
> IDLE
  WARNING: The script wheel.exe is installed in 'C:\cog\git\at\keycloak\install\build\bootstrap\python311_64\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.
  WARNING: The scripts pip.exe, pip3.11.exe and pip3.exe are installed in 'C:\cog\git\at\keycloak\install\build\bootstrap\python311_64\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.
C:\cog\git\at\keycloak\install\build\bootstrap\python311_64\python.exe: No module named pip
Process 'command 'C:\cog\git\at\keycloak\install\build\bootstrap\python311_64\python.exe'' finished with non-zero exit value 1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Bootstrap_PYTHON_'python311_64'_from_archive'.
> Process 'command 'C:\cog\git\at\keycloak\install\build\bootstrap\python311_64\python.exe'' finished with non-zero exit value 1

Ambiguious call when no directory set

Given a basic build.gradle.kts (using the kotlin-dsl):

plugins {
    base
    idea
    id("com.jetbrains.python.envs") version "0.0.30"
}

envs {
    python("python35_64", "3.7.2", "64", listOf())
}

Running ./gradlew tasks --stacktrace gives the following error:

* What went wrong:
Ambiguous method overloading for method java.io.File#<init>.
Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between:
        [class java.lang.String, class java.lang.String]
        [class java.io.File, class java.lang.String]

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

* Exception is:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.io.File#<init>.
Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between:
        [class java.lang.String, class java.lang.String]
        [class java.io.File, class java.lang.String]
        at com.jetbrains.python.envs.Python.<init>(PythonEnvsExtension.groovy:231)
        at com.jetbrains.python.envs.Python.<init>(PythonEnvsExtension.groovy)
        at com.jetbrains.python.envs.PythonEnvsExtension.python(PythonEnvsExtension.groovy:41)
        at Build_gradle$2.execute(build.gradle.kts:40)
        at Build_gradle$2.execute(build.gradle.kts:3)

What I noticed is that when I change the envs block to include a bootstrapDirectory, I am able to successfully run ./gradlew tasks, so it seems like this error has something to do with the null value being passed as the bootstrap dir?

bootstrapJython task is always executed

=== build.gradle ===

buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.jetbrains.python:gradle-python-envs:0.0.8"
}
}

apply plugin: "com.jetbrains.python.envs"
envs {
bootstrapDirectory = new File(buildDir, 'pythons')
envsDirectory = new File(buildDir, 'envs')
minicondaVersion = 'latest'
packages = ["pip", "setuptools"]
}

=== gradle output ===
:build_conda_envs SKIPPED
:bootstrapJython
Performing silent installation
10 %
20 %
30 %
40 %
50 %
60 %
70 %
80 %
Generating start scripts ...
Installing pip and setuptools
90 %
Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-7.1.2 setuptools-19.2
100 %
Congratulations! You successfully installed Jython 2.7.1b3 to directory /Users/ahutalla/projects/xdn-gateway/build/pythons/jython.
Collecting virtualenv
Using cached virtualenv-15.0.2-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-15.0.2
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
:build_jython_envs SKIPPED
:create_files SKIPPED
:build_envs UP-TO-DATE
:assemble UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE

Python 2.7 can't be installed because of the wrong get-pip script used

I have such python env config:

createPython("py27_jupyter",  "2.7.18", ...)

I'm getting this error:

Downloading & installing pip and setuptools
[ant:get] Getting: https://bootstrap.pypa.io/get-pip.py
[ant:get] To: C:\Projects\intellij\python\jupyter\setup-jupyter-env\build\get-pip.py
Starting process 'command 'C:\Projects\intellij\python\jupyter\setup-jupyter-env\build\pythons\py27_jupyter\python.exe''. Working directory: C:\Projects\intellij\python\jupyte
r\setup-jupyter-env Command: C:\Projects\intellij\python\jupyter\setup-jupyter-env\build\pythons\py27_jupyter\python.exe C:\Projects\intellij\python\jupyter\setup-jupyter-env\
build\get-pip.py
Successfully started process 'command 'C:\Projects\intellij\python\jupyter\setup-jupyter-env\build\pythons\py27_jupyter\python.exe''
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.
Process 'command 'C:\Projects\intellij\python\jupyter\setup-jupyter-env\build\pythons\py27_jupyter\python.exe'' finished with non-zero exit value 1

Maybe we need to install different get-pip-s for different Pythons?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.