How can I manually install a package in racket (that is without relying on raco)? Is that possible?
I installed the minimal racket distribution and want to manually add the packages in question (such as xrepl which doesn't seem to come by default).
I'm on CentOS and I have no root privileges (the installation is in a private directory).
Although I'm not sure I understand the permissions issue you're having, you could try raco pkg install --scope user.
Anyway, you can use raco pkg install --link <dir> to install locally. (Just like what people do when they're developing a package locally.)
So for example:
cd ~/src
git clone path/to/foo
(Or get the package source into ~/src/foo some other way. By "package source" I mean there should be an info.rkt in ~/src/foo.)
raco pkg install --link foo
If the foo package has any dependencies, than raco pkg install will offer to get and install them, too. Normally this would be handy. But since you're having connection or permission problems, I imagine you'll want to answer No. Instead, do this manual install for each of the deps, then retry this one. (Obviously if there are many deps, this is inconvenient, which is one of the benefits of using a package manager when you are able to.)
Related
I am trying to update an old racket package I had written ages ago to run on the new racket. I found the documentation extremely confusing and seemingly broke everything. Can you please suggest how things can be resolved?
While trying to run raco pkg install {path/to/package} I got an error saying my package was trying to find the old Racket 6.4 installation and since I have updated my operating system since then it didn't find it. I searched in that directory and could only find such references in the compiled/ folder. I skimmed the raco documentation and saw that raco setup --clean would remove that compiled folder. However, I thought it would be context specific: working on just the package who's directory I was in. That appears to not be the case. Now raco pkg doesn't even exist as a sub-command of raco!
How can I restore it and get back to trying to update my package so that it can be installed on the latest racket?
When you run raco, it works on the installation that it's a part of. So, for instance, if you have two copies of racket installed at /Users/clements/racket1/racket and /Users/clements/racket2/racket, then if I run the raco that's a part of the racket1 installation, I'll be updating the packages that are associated with the racket1 installation.
Sounds sensible, but I've messed this up myself, many times: depending on how your path is set up, the command raco may refer to either the racket1 or the racket2 installation. The problem here isn't really with racket, it's with the idea of paths, and how easy it is to mess things up when you have two installations containing the same binaries.
(And, of course, apologies if I'm misunderstanding your problem!)
I have a Python library (https://github.com/jcrozum/PyStableMotifs) that I want to publish on PyPI. It depends on another library (https://github.com/hklarner/PyBoolNet) that I do not control and that is only available on GitHub, and in particular, it is not available on PyPI. My setup.py looks like this:
from setuptools import
setup(
... <other metadata> ...,
install_requires=[
'PyBoolNet # git+https://github.com/hklarner/PyBoolNet#2.3.0',
... <other packages> ...
]
)
Running pip install git+https://github.com/jcrozum/PyStableMotifs works perfectly, but I can't upload this to PyPI because of the following error from twine:
Invalid value for requires_dist. Error: Can't have direct dependency: 'PyBoolNet # git+https://github.com/hklarner/PyBoolNet#2.3.0'
My understanding is that direct links are forbidden by PyPI for security reasons. Nonetheless, PyBoolNet is a hard requirement for PyStableMotifs. What do I do? Give up on PyPI?
I just want pip install PyStableMotifs to work for my users. Ideally, this command should install the dependencies and I should not have to maintain two versions of setup.py.
Failing that, I have considered creating a "dummy" package on PyPI directing users to install using the command pip install git+https://github.com/jcrozum/PyStableMotifs. Is this a bad idea (or even possible)?
Are there already established best practices for this situation or other common workarounds?
EDIT:
For now, I have a clunky and totally unsatisfying workaround. I'm keeping two versions; a GitHub version that works perfectly, and a PyPI version that has the PyBoolNet requirement removed. If the user tries to import PyStableMotifs without PyBoolNet installed, an error message is shown that has install instructions for PyBoolNet. This is far from ideal in my mind, but it will have to do until I can find a better solution or until PyPI fixes this bug (or removes this feature, depending on who you ask).
My recommendation would be to get rid of the direct URL in install_requires, and tell your users where they can find that dependency PyBoolNet since it is not on PyPI. Don't force them on a specific installation method, but show them an example.
Maybe simply tell your users something like:
This project depends on PyBoolNet, which is not available on PyPI. One place where you can find it is at: https://github.com/hklarner/PyBoolNet.
One way to install PyStableMotifs as well as its dependency PyBoolNet is to run the following command:
python -m pip install 'git+https://github.com/hklarner/PyBoolNet#2.3.0#egg=PyBoolNet' PyStableMotifs
You could additionnally prepare a requirements.txt file and tell your users:
Install with the following command:
python -m pip install --requirement https://raw.githubusercontent.com/jcrozum/PyStableMotifs/master/requirements.txt
The content of requirements.txt could be something like:
git+https://github.com/hklarner/PyBoolNet#2.3.0#egg=PyBoolNet
PyStableMotifs
But in the end, you should really let your users choose how to install that dependency. Your project only need to declare that it depends on that library but not how to install it.
I frequently like to use raco pkg install --clone (or raco pkg --update clone if the library is already installed), when I want to work on a library and submit patches.
However, I accidentally ran raco pkg update --clone in the wrong folder, and now I can't seem to get it to move to the correct directory.
I tried simply moving the directory, but racket (understandably) didn't know how to handle that, and I tried just deleting the directory, but that didn't work either.
I could theoretically uninstall the package and reinstall it. But I have a lot of packages that already depend on it installed, and it would be very annoying to have to uninstall all of them, and reinstall them all again.
Do I have any other options, or am I just doomed to manually uninstalling and reinstalling a lot of packages (or just reinstalling the whole Racket distribution)?
Yes, you can convert a --cloneed package back into a regular package. The flag you are looking for is --lookup. What you should do is:
raco pkg update --lookup <my-package>
cd to/the/desired/dir
raco pkg update --clone <my-package>
Note that all --lookup does is tell Racket to use the downloaded copy it has, rather than the cloned repo you had it point to. It does NOT delete the old cloned repo. So if you no longer want it on your system, you have to remove it yourself.
Additionally, note the use of raco pkg update here. Even if you got into the problem by running raco pkg install --clone ... in the wrong directory, you still should run raco pkg update ... here, because you are only moving where Racket looks to find the package
Finally, you can use --lookup and --clone at the same time:
cd to/the/desired/dir
raco pkg update --lookup --clone <my-package>
I should also note that this answer is based on a similar question from the Racket mailing list
I have a fresh Julia instalation on a machine that I want to use as a number-crunching server for various persons on a lab. There seems to be this nice package called jupyterhub wich makes the Jupyter Notebook interface avaible to various clients simultaneusly. A web page which I am unable to find again began suggesting something like "first install IJulia globally, then install JupyterHub..."
I cannot seem to find a nice way to install ONE package globally.
Update
In Julia-v0.7+, we need to use JULIA_DEPOT_PATH instead of JULIA_PKGDIR and the LOAD_PATH looks something like this:
julia> LOAD_PATH
3-element Array{Any,1}:
Base.CurrentEnv()
Any[Base.NamedEnv("v0.7.0"), Base.NamedEnv("v0.7"), Base.NamedEnv("v0"), Base.NamedEnv("default"), Base.NamedEnv("v0.7", create=true)]
"/Users/gnimuc/Codes/julia/usr/share/julia/stdlib/v0.7"
Old Post
"first install IJulia globally, then install JupyterHub..."
I don't know whether this is true or not, by following these steps below, you can install IJulia after you installed Jupyterhub.
Install packages system-wide/globally for every user
this question has already been answered here by Stefan Karpinski. so what we need is just use this method to install the IJulia.jl package.
There's a Julia variable called LOAD_PATH that is arranged to point at two system directories under your julia installation. E.g.:
julia> LOAD_PATH
2-element Array{Union(ASCIIString,UTF8String),1}:
"/opt/julia-0.3.3/usr/local/share/julia/site/v0.3"
"/opt/julia-0.3.3/usr/share/julia/site/v0.3"
If you install packages under either of those directories, then everyone using that Julia will see them. One way to do this is to run julia as a user who can write to those directories after doing export JULIA_PKGDIR=/opt/julia-0.3.3/usr/share/julia/site in the shell. That way Julia will use that as it's package directory and normal package commands will allow you to install packages for everyone....
Make IJulia working with Jupyterhub
in order to make IJulia and Jupyterhub working with each other for all the users, you should copy the folder your/user/.local/share/jupyter/kernels/julia/ to /usr/local/share/jupyter/kernels/. I write down some of the steps that I used in my test Dockerfile. the code is ugly, but it works.
Steps: (after you successfully installed Jupyterhub)
note that, you should do the following steps as root and I assume that your julia was globally installed at /opt/julia_0.4.0/.
make our global package directory and set up JULIA_PKGDIR:
mkdir /opt/global-packages
echo 'push!(LOAD_PATH, "/opt/global-packages/.julia/v0.4/")' >> /opt/julia_0.4.0/etc/julia/juliarc.jl
export JULIA_PKGDIR=/opt/global-packages/.julia/
install "IJulia" using package manager:
julia -e 'Pkg.init()'
julia -e 'Pkg.add("IJulia")'
copy kernelspecs to /usr/local/share/jupyter/kernels/ which can be used by any new user added by Jupyterhub:
jupyter kernelspec list
cd /usr/local/share/ && mkdir -p jupyter/kernels/
cp -r /home/your-user-name/.local/share/jupyter/kernels/julia-0.4-your-julia-version /usr/local/share/jupyter/kernels/
I'm attempting to create a local yum repo on my system containing various packages from, chiefly, the CentOS base repos. The server which is hosting the yum repo will not necessarily have the same base packages installed by default as the servers which will be using the yum repo. For this reason, I need to ensure that my repos contain the packages that I want and every single one of their dependencies.
I'm creating my repos using the yumdownloader tool provided in the yum-utils package to try to download an RPM file for a package using yum from the standard CentOS mirrors. Helpfully it provides a command line option, --resolve, which also downloads dependencies. However, because it's built on yum itself, yumdownloader will only download dependencies for the package that are not already present on the system.
For example, I wish to download package A, which depends on Packages B, C and D. If package D is already installed on the system, yumdownloader --resolve A will only download A, B and C, but not D.
Is there a way to download the RPMs for all dependencies on a package from a yum repo?
There's this bash script, which the maintainer of rpm has kindly shared with me, and I put on github. Hope you find it useful!
You can also read the original SO question, where the issue was discussed.
The script works on Fedora 23+ as it uses dnf's download plugin. It's probably very easy to make it work on Fedora 22-, as yum surely has got a similar plugin.
Additionaly, it's valuable since repotrack does not work on fedora 23 (at least it doesn't work for me).
After a lot of frustration looking around for a solution I have written a simple script that uses repotrace and wget. I've found that yumdownloader (even with the resolve flag) does not resolve all dependencies.
if you have a long list of packages you are bound to run into duplicates, downloading just the urls first with the "repotrack -u flag" and then getting unique records resolves having to download the same rpm multiple times.
#!/bin/bash
while read i; do
repotrack -u $i >> dep_rpm_urls_02.txt
done < list_of_packages_01.txt
awk '!seen[$0]++' dep_rpm_urls_02.txt > dep_rpm_urls_clean_03.txt
while read j; do
wget $j
echo dowloaded $j
done < dep_rpm_urls_clean_03.txt
happy rpming