In the pkg mode of the Julia 1.0 REPL I can do the following to get add a specific branch of my unregistered package:
(v1.0) pkg> add https://github.com/JuliaRheology/RHEOS.jl#v1compat
However, if I want to dev a specific branch:
(v1.0) pkg> dev https://github.com/JuliaRheology/RHEOS.jl#v1compat
I get:
ERROR: invalid token
Is it possible to dev
a package with a non-master branch?
Thanks
2 Likes
You can dev
and then just change the branch with e.g git
.
My master branch is still Julia 0.6 so I get the following error:
ERROR: Unsatisfiable requirements detected for package JLD [4138dd39]:
JLD [4138dd39] log:
├─possible versions are: [0.5.0-0.5.9, 0.6.0-0.6.11, 0.8.0-0.8.3] or uninstalled
├─restricted to versions 0.0.0-* by RHEOS [4bf54d18], leaving only versions [0.5.0-0.5.9, 0.6.0-0.6.11, 0.8.0-0.8.3]
│ └─RHEOS [4bf54d18] log:
│ ├─possible versions are: 0.0.0 or uninstalled
│ └─RHEOS [4bf54d18] is fixed to version 0.0.0
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
Maybe there’s a way to ignore errors? If possible I’d like to avoid changing the master branch for now.
Are you using 1.0.1? There’s been some fixes there that might help this.
When using dev
the normal julia compatibility that is used in add
should be disregarded…
1 Like
Yep 1.0.1, downloaded it today. Hmm that’s strange. In case it helps this is the full feedback:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.1 (2018-09-29)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
(v1.0) pkg> dev https://github.com/JuliaRheology/RHEOS.jl
Updating registry at `C:\Users\louis.kaplan\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Updating git-repo `https://github.com/JuliaRheology/RHEOS.jl`
[ Info: Assigning UUID 4bf54d18-b41c-58dc-8574-a0581551535a to RHEOS
[ Info: Path `C:\Users\louis.kaplan\.julia\dev\RHEOS` exists and looks like the correct package, using existing path instead of cloning
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package JLD [4138dd39]:
JLD [4138dd39] log:
├─possible versions are: [0.5.0-0.5.9, 0.6.0-0.6.11, 0.8.0-0.8.3] or uninstalled
├─restricted to versions 0.0.0-* by RHEOS [4bf54d18], leaving only versions [0.5.0-0.5.9, 0.6.0-0.6.11, 0.8.0-0.8.3]
│ └─RHEOS [4bf54d18] log:
│ ├─possible versions are: 0.0.0 or uninstalled
│ └─RHEOS [4bf54d18] is fixed to version 0.0.0
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
I wonder if I’ve messed something up here by adding the specific branch too?
Some further info, now when I navigate to \.julia\dev\RHEOS
there is a folder there but when I type git branch
it just shows the master
branch.
And just in case it is helpful for diagnosis I’m on Windows 7 (64 bit) and installed Julia from .exe (not from source).
This is the expected behavior.
2 Likes
Ah I thought that all branches should be cloned in with the dev
command and Kristoffer’s comment was saying I should be able to just checkout the branch. I understand now he meant I need to fetch it in. I did the following:
git fetch origin v1compat:v1compat
which seems to have worked. However it still seems counter-intuitive to yield and error yet still produce what in my case is basically the desired result?
EDIT: The files in the directory have updated as expected but when I try using RHEOS
I get the following Error message:
julia> using RHEOS
ERROR: ArgumentError: Package RHEOS not found in current path:
- Run `import Pkg; Pkg.add("RHEOS")` to install the RHEOS package.
Stacktrace:
[1] require(::Module, ::Symbol) at .\loading.jl:820
And although I was sure it wouldn’t work, just for full clarity I did try the REPL suggestion, which didn’t work as it is not a registered package:
julia> import Pkg
julia> Pkg.add("RHEOS")
Updating registry at `C:\Users\louis.kaplan\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
ERROR: The following package names could not be resolved:
* RHEOS (not found in project, manifest or registry)
Please specify by known `name=uuid`.
Also to note, when I add
RHEOS (correct branch) and type using RHEOS
it works fine (I have removed RHEOS since then to try and focus on getting the dev
version working without any confusion).
Thanks. Just to check, did you mean disregarded by the user or disregarded by Julia?
OK, finally got it working.
I did the following
- In Julia
pkg
mode: dev https://github.com/JuliaRheology/RHEOS.jl
- Exited Julia
-
git fetch origin v1compat:v1compat
(in the dev/RHEOS directory)
git checkout v1compat
- In Julia
pkg
mode: dev https://github.com/JuliaRheology/RHEOS.jl
In the first step I get the error message described above but it still downloads the folder. In the last fifth step I do not get any error message and I can now do using RHEOS
. To emphasise, I could not do using RHEOS
at any point until completing all these steps.
Is this the intended behaviour? Seems a little counter-intuitive (to a fairly inexperienced Julia user). If it is I may try add a PR to the documentation to add info on this.
Can you just do resolve
at the pkg prompt instead of the final dev
? You have to do this if dependencies change via non-pkg operations (e.g. editing a file or running a git command).
Trying that now (so as my above post steps 1 - 4, and then resolve
instead of step 5), then back to normal Julia REPL:
julia> using RHEOS
ERROR: ArgumentError: Package RHEOS not found in current path:
- Run `import Pkg; Pkg.add("RHEOS")` to install the RHEOS package.
Stacktrace:
[1] require(::Module, ::Symbol) at .\loading.jl:820