Giter Club home page Giter Club logo

pyjuliapkg's People

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

Watchers

 avatar  avatar  avatar

pyjuliapkg's Issues

Both julia and juliaup are in my path, but still juliapkg downloads a new version of julia

(ewatercycle_spyder) tesla-k20c@teslak20c:~$ julia --version
julia version 1.5.4
(ewatercycle_spyder) tesla-k20c@teslak20c:~$ juliaup status
 Default  Channel  Version                Update
-----------------------------------
       *  1.5      1.5.4+0.x64.linux.gnu
          1.6.7    1.6.7+0.x64.linux.gnu
(ewatercycle_spyder) tesla-k20c@teslak20c:~$ python
Python 3.10.2 | packaged by conda-forge | (main, Feb  1 2022, 19:28:35) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> **import juliapkg**
>>> juliapkg.status()
JuliaPkg Status
/home/tesla-k20c/.conda/envs/ewatercycle_spyder/julia_env/pyjuliapkg/juliapkg.json
Not resolved (resolve for more information)
Julia (^1.5)
>>> juliapkg.resolve()
[juliapkg] Locating Julia ^1.6.1
[juliapkg] Querying Julia versions from https://julialang-s3.julialang.org/bin/versions.json
[juliapkg] Using Julia 1.8.5 at /home/tesla-k20c/.conda/envs/ewatercycle_spyder/julia_env/pyjuliapkg/install/bin/julia

I need julia version 1.5, but even though julia and juliaup are in my path juliapkg installs a new version. What am I missing here? Thanks in advance.

Segfault during resolving on compute clusters

>>> juliapkg.resolve()
[juliapkg] Locating Julia ^1.6.1
[juliapkg] Using Julia 1.9.1 at /cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Core/julia/1.9.1/bin/julia
[juliapkg] Using Julia project at /home/aminsad/Code/venv/julia_env
[juliapkg] Installing packages:
           julia> import Pkg
           julia> Pkg.add([Pkg.PackageSpec(name="PythonCall", uuid="6099a3de-0909-46bc-b1f4-468b9a2dfc0d"), Pkg.PackageSpec(name="EquivalentCircuits", uuid="da5bd070-f609-4e16-a30d-de86b3faa756", url=raw"https://github.com/ma-sadeghi/EquivalentCircuits.jl", rev=raw"bug/fix-ndarray-serialization")])
           julia> Pkg.resolve()
           julia> Pkg.precompile()
     Cloning git-repo `https://github.com/ma-sadeghi/EquivalentCircuits.jl`

[29527] signal (11.1): Segmentation fault
in expression starting at none:1
unknown function (ip: 0x1)
unknown function (ip: 0x2ad48c8d95ae)
Allocations: 1687247 (Pool: 1686073; Big: 1174); GC: 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/aminsad/Code/venv/lib/python3.11/site-packages/juliapkg/deps.py", line 282, in resolve
    run([exe, '--project='+project, '--startup-file=no', '-e', '; '.join(script)], check=True, env=env)
  File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Core/python/3.11.5/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Core/julia/1.9.1/bin/julia', '--project=/home/aminsad/Code/venv/julia_env', '--startup-file=no', '-e', 'import Pkg; Pkg.add([Pkg.PackageSpec(name="PythonCall", uuid="6099a3de-0909-46bc-b1f4-468b9a2dfc0d"), Pkg.PackageSpec(name="EquivalentCircuits", uuid="da5bd070-f609-4e16-a30d-de86b3faa756", url=raw"https://github.com/ma-sadeghi/EquivalentCircuits.jl", rev=raw"bug/fix-ndarray-serialization")]); Pkg.resolve(); Pkg.precompile()']' died with <Signals.SIGSEGV: 11>. 

BUG: if PYTHON_JULIAPKG_PROJECT is set to existing Project, the project get's deleted

via PythonCall/JuliaCall I came to use JuliaPkg

unfortunately sofar JuliaPkg creates more problems than it solves. I am using PythonCall on mybinder, however the JuliaPkg creates its own empty Project, not using the binder project.

Even worse: If setting PYTHON_JULIAPKG_PROJECT to the directory where the binder Project.toml lies, it overwrites the existing Project.toml file, deleting the previous environment and leaving JuliaPkg empty environment.

How to force a julia version using juliapkg.json?

I'm working in a conda environment and I need julia 1.5.
Following the documentation, I ran the following:

>>> juliapkg.require_julia("1.5")
>>> juliapkg.status()
JuliaPkg Status
/home/tesla-k20c/.conda/envs/ewatercycle_spyder/julia_env/pyjuliapkg/juliapkg.json
Not resolved (resolve for more information)
Julia (^1.5)
>>> juliapkg.resolve()
[juliapkg] Locating Julia ^1.6.1
[juliapkg] Using Julia 1.8.5 at /home/tesla-k20c/.conda/envs/ewatercycle_spyder/julia_env/pyjuliapkg/install/bin/julia

How can I specify the julia version exactly, instead of only giving a minimum requirement? And why does it try to locate ^1.6.1 and not ^1.5.1?
Thanks!

CONDA_PREFIX overriding JULIA_DEPOT_PATH

Currently, $CONDA_PREFIX (and $VIRTUAL_ENV) overrides ignores $JULIA_DEPOT_PATH. This is a problem in scenarios where (Ana)conda is installed in a read-only location, like an Apptainer/Shifter container or a shared storage location on a larger multi-user compute system/cluster. Since $JULIA_DEPOT_PATH gets ignored, the user runs into trouble like this

[...]
[juliapkg] Using Julia project at /opt/anaconda3/julia_env
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/user/.local/lib/python3.9/site-packages/juliapkg/deps.py", line 278, in project
    resolve()
  File "/user/.local/lib/python3.9/site-packages/juliapkg/deps.py", line 233, in resolve
    os.makedirs(project, exist_ok=True)
  File "/opt/anaconda3/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/opt/anaconda3/julia_env'

Could we change the resolution mechanism so that $JULIA_DEPOT_PATH takes priority over $CONDA_PREFIX (and ideally $VIRTUAL_ENV as well)?

using an existing julia environment

Hi, thanks for your great packages including PythonCall and this one!

I've recently got started with PythonCall, especially the JuliaCall package from Python.

As my requirement is to access an existing Julia environment instead of creating a fresh one, I tried specifying PYTHON_JULIAPKG_PROJECT. Unfortunately, juliapkg just rewrites the existing Project.toml, and I haven't got a success without modifying the source code of PythonCall.jl.

I wonder if there can be a way to specify the current project without any hardcoding.

how to call package in python

Hello i added juliapkg.json

{
    "packages": {
        "MedPipe3D": {
            "uuid": "80492ae4-ba08-4770-a16e-2cec06b8739e",
            "version": "0.1.0"
        }
    }
}

I had written in python

from juliacall import Main as jl
import juliapkg
juliapkg.resolve()

no errors here

still in python

import MedPipe3D

do not work

but how to start using MedPipe3D now - I had no problem in calling python packages in Julia using your tool - really fantastic job, here it is probably sth simple also - but I just do not see how to import MedPipe3D as a reference

check if `juliaup` is update to date

should check or just run juliaup self upgrade before juliaup add <julia version>, otherwise we will end up in this error

(base) ➜  python git:(roger/python) ✗ juliaup add 1.7.3
Error: '1.7.3' is not a valid Julia version or channel name.

because my local juliaup was not updated after 1.7.3 was released

wrong juliapkg.json path found

this is just a standard python package setup as following

.
├── README.md
├── juliapkg.json
├── pdm.lock
├── pdm_build.py
├── pyproject.toml
├── src
│   └── bloqade
│       ├── __init__.py
└── tests
    ├── __init__.py
    ├── test_scalar.py
    └── test_shape.py

where in the bloqade module, it calls juliacall, directly running python test_shape.py will not use juliapkg.json but creates an empty new one. This behavior does not look right.

This is causing things like pytest not working

Lightweight check for julia dependencies

Currently, at least when we are not in offline mode, we Pkg.add all dependencies on every resolve. This is rather slow and can trigger unrequested package updates to indirect dependencies. It's also unnecessary when the required packages are already installed.

Fortunately, once can use Pkg.dependencies() to check versions without doing any add or resolve. For example:

def check_julia_deps():
    import juliapkg
    from juliacall import Main as jl
    from juliacall import Pkg

    avail_jl = Pkg.dependencies()
    for p in juliapkg.deps.required_packages():
        logger.debug(f"Checking pkg '{p.name}'.")
        try:
            dep_info = avail_jl[jl.Base.UUID(p.uuid)]
        except KeyError:
            logger.debug(f"Pkg '{p.name}' not found in Julia Manifest.")
            return False
        if not dep_info.is_direct_dep:
            logger.debug(f"Pkg '{p.name}' not found in Julia Project.")
            return False
        if p.dev:
            if dep_info.is_tracking_path:
                continue
            else:
                logger.debug(f"Pkg '{p.name}' should be dev'd, but isn't.")
                return False
        # NOTE: Julia Pkg.Versions.semver_spec may not be stable API
        if p.version and dep_info.version not in Pkg.Versions.semver_spec(p.version):
            logger.debug(f"Pkg '{p.name}' at {dep_info.version} not compatible with '{p.version}'.")
            return False
    return True

This does not cover all possible cases, I think, but could be extended. Should something like this be added to pyjuliapkg?

respect pyproject.toml

I'm wondering if we can instead of creating a juliapkg.json, but putting a field inside pyproject.toml like

[julia.dependencies]
julia = "1.8"
Example = "0.5"
PythonCall = "0.8"

this would making packaging a lot easier because pyproject.toml will be saved in a package wheel.

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.