install ctan package ragged2e for latex on nixos - installation

tldr: I need to know how to install the ragged2e package on nixos.
I have a latex project that uses the package ragged2e (here it is on ctan). More concrete, it contains the line \usepackage{ragged2e}. I want to build this project on my nixos machine.
I am very new to nix and nixos. I did read the texlive section of the nixos manual (although I didn't understand the last part about "custom packages").
My nixos config contains the following line:
environment.systemPackages = with pkgs; [
# ... some other packages
texlive.combine {
inherit (texlive) scheme-basic latexmk etoolbox babel-german;
}
];
Unfortunatelly the package ragged2e doesn't seem to be available on nixos: The following doesn't provide any results:
$ nix repl
nix-repl> :l <nixpkgs>
nix-repl> texlive.ragged<TAB>
So now I don't know how to install the ragged2e package.

Related

Unable to use locally built python package in development mode

I'm trying to spin up a super simple package for proof of concept and I can't see what i'm missing.
My aim is to be able to do the following:
python3 import mypackage
mypackage.add2(2)
>> 4
Github link
I created a public repo to reproduce the issue here
git clone https://github.com/OliverFarren/testPackage
Problem
I have a basic file structure as follows:
src/
mypackage/
__init__.py
mymodule.py
setup.cfg
setup.py
pyproject.toml
setup.cfg is pretty boiler plate from here
setup.py is just to allow pip install in editable mode:
import setuptools
setuptools.setup()
I ran the following commands at the top level directory in my Pycharm virtual env:
python3 -m pip install --upgrade build
python3 -m build
That created my dist and build directories and mypackage.egg-info file so now the directory looks like this:
testpackage
build/
bdist.linux-x86_64/
dist/
mypackage-0.1.0.tar.gz
mypackage-0.1.0-py3-none-any.whl
src/
mypackage/
mypackage.egg-info
__init__.py
mymodule.py
setup.cfg
setup.py
pyproject.toml
I've then tried install the package as follows:
sudo pip3 install -e .
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Installing collected packages: mypackage
Running setup.py develop for mypackage
Successfully installed mypackage
Which I think should have installed it. Except when I try and import the package I get a ModuleNotFoundError
I'm wondering whether this is a permissions issue of some sort. When I try:
sudo pip3 list
pip3 list
I notice i'm getting different outputs, I can see my package present in the list and in my sys.path:
~/testpackage/src/mypackage'
I just don't understand what i'm missing here. Any advice would be appreciated!
Ok so I found the issue. Posting solution and leaving the github repo live - with fix, incase anyone else has this issue.
It turns out my setup.cfg wasn't boiler plate.
Here was my incorrect code:
[metadata]
# replace with your username:
name = mypackage
author = Oliver Farren
version = 0.1.0
description = Test Package
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: MIT License
Operating System :: OS Independent
[options]
package_dir =
= src/mypackage
packages = find:
python_requires = >=3.6
[options.packages.find]
where = src/mypackage
src/mypackage should be src, it was looking inside the package for packages.
A key step in debugging this issue was checking the mypackage.egg.info files. The SOURCES.txt contained a list of all the files in the build package and I could clearly see that in the incorrect build, that src/mypackage/mymodules.py and src/mypackage/__init__.py were missing. So the package was correctly installed by pip, but being empty was making for a very confusing error message.

Failde to compile : ocamlfind: Package `xmlm' not found

I am trying to compile an OCaml .ml file with make command via command line remote machine but it shows me this error:
+ ocamlfind ocamlc -c -package xmlm -package unix -o pms.cmo pms.ml
ocamlfind: Package `xmlm' not found
Command exited with code 2.
Hint: Recursive traversal of subdirectories was not enabled for this build,
as the working directory does not look like an ocamlbuild project (no
'_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
you should add the option "-r" or create an empty '_tags' file.
To enable recursive traversal for some subdirectories only, you can use the
following '_tags' file:
true: -traverse
<dir1> or <dir2>: traverse
Compilation unsuccessful after building 6 targets (5 cached) in 00:00:00.
Makefile:10 : la recette pour la cible « native » a échouée
make: *** [native] Erreur 10
I tried to export the environment with this command:
eval $(/usr/bin/opam config env --root=/path/Ocaml/opam-ocaml-4.04-strech)
But also I had this error :
# opam-version 1.2.2
# os linux
File /p/opas/src/Ocaml/opam-ocaml-4.04-strech/config does not exist
while the config file does exist in the directory
any help Please ?!!
Thank you
To make a package available via opam (assuming that opam is properly installed and configured) you need to:
install the package
activate your opam
To install a package named foo, execute the following command in your shell
opam install foo
To activate your opam installation (which enables the search paths), issue the following command
eval $(opam config env)
or, with modern opam (that is of version 2.x) just eval $(opam env)
Before doing this, you need to properly initialize your opam installation, i.e., to install the compiler (or use the system compiler) and the base packages. This is done via the opam init command that creates an opam-managed subdirectory in your home, e.g., using an (old by today's standards) OCaml version 4.04.0, you can initialize it like this
opam init --comp=4.04.0
once the initialization is finished, do not forget to activate it via eval $(opam config env) and now you can install the package.
Finally, the version of opam that you're using is outdated and long ago deprecated, thus it is not receiving updates and the repositories that this version can understand are frozen and no longer updated. You really need to update your opam to a 2.x version. Please follow the opam installation instructions to get the latest version.

Protobuf timestamp not found

Relatively new to GRPC and getting an error in my proto file that I cannot seem to make sense of. I would like to send a time in a message using the "google.protobuf.Timestamp". I cannot seem to import it. What am I doing wrong?
syntax = "proto3";
import "google/protobuf/timestamp.proto";
service ProfileService {
rpc ConstructProfileStructFromUser (ConstructProfileStructFromUserRequest) returns (ConstructProfileStructFromUserResponse);
}
message ConstructProfileStructFromUserRequest {
string transactionID = 1;
string User = 2;
}
message ConstructProfileStructFromUserResponse {
string UID = 1;
string ContactEmail = 2;
google.protobuf.Timestamp DateOfBirth = 3;
}
Both in my IDE and my compiler (using the below command) then I get the error
google/protobuf/timestamp.proto: File not found.
profile.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
profile.proto:21:5: "google.protobuf.Timestamp" is not defined.
Command to run:
protoc -I profile/ profile/profile.proto --go_out=plugins=grpc:profile
Protoc --version
libprotoc 3.0.0
I had this issue after installing the protoc compiler using the apt package manager (Ubuntu) and it put the protoc compiler somewhere like /usr/local/bin.
It seems by default protoc expects imports to be present in an include path relative to the protoc installation directory. For example:
protoc location: /usr/local/bin/protoc
include location: /usr/local/bin/include/*
Install pre-compiled binaries (any OS)
Downloading a pre-compiled binary as indicated below will have the needed include directory.
Instructions from grpc.io/docs/protoc-installation
Manually download from github.com/google/protobuf/releases the zip file corresponding to your operating system and computer architecture (protoc--.zip), or fetch the file using commands such as the following:
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
Unzip the file under $HOME/.local or a directory of your choice. For example:
unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
Update your environment’s path variable to include the path to the protoc executable. For example:
export PATH="$PATH:$HOME/.local/bin"
If you installed protoc with your package manager, you only have to install the libprotobuf-dev (Ubuntu) or protobuf-devel (Fedora) package.
In general, you can find the containing package of a file on Ubuntu with
apt-file find google/protobuf/timestamp.proto
or on Fedora
dnf repoquery --file "**/google/protobuf/timestamp.proto" (this is how I found the package I needed). Other package managers probably have similar commands.
My problem was quite simple...
I didn't have the timestamp.proto downloaded locally and as a result it couldn't find it.
I cloned:
https://github.com/protocolbuffers/protobuf/tree/master/src/google/protobuf
And then when I run my compiler I have to give it the location to locate the timestamp.proto files.
For me it was...
protoc -I profile/ -I MY_CLONED_REPO_LOCATION/protobuf/src profile/profile.proto --go_out=plugins=grpc:profile
Once it knew where it had the path to the source then it could find it with no issues.
I had same problem with protoc 3.0.0 installed from ubuntu repo. I have found another solution, without reinstalling protobuf as #SwiftD suggested, using --proto_path protoc option.
In your .proto import should look like (i.e. without path):
syntax = "proto3";
import "timestamp.proto"
Then in the protoc invocation you pass absolute path to your package directory containing timestamp.proto (I use github.com/golang/protobuf/ptypes/timestamp) using --proto_path option.
protoc kcproto.proto --go_out=./ --proto_path=/home/my_home_dir_name/go/src/github.com/golang/protobuf/ptypes/timestamp --proto_path=./
replace /home/my_home_dir_name/ with your go package directory
For mac, I run this in the terminal
PROTOC_ZIP=protoc-3.14.0-osx-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
Note that you can change the version protoc-3.14.0 to whatever your need, for example protoc-3.x.x
Docs: http://google.github.io/proto-lens/installing-protoc.html
If you download from https://github.com/protocolbuffers/protobuf/releases, in the download directory there is an include directory, where all the google defined types (such as google/protobuf/timestamp.proto) live.
You can pass in an extra parameter --proto_path=/path/to/include to your protoc command, and it should work.
Go to the VSCode proto 3 extension settings and paste "protocol" at the end of the file:
"protoc": {
"options": [
"--proto_path=proto",
]
}
}
I had the same problem with
import "google/protobuf/timestamp.proto";
I'm on a fedora and installed protocol buffer compiler using the package manager dnf .
solution : delete your current protoc using then package manger .
on fedora:
sudo dnf remove protobuf-compiler
then follow the instruction to Install pre-compiled binaries (any OS) :
find the appropriate version of compiler herer https://github.com/protocolbuffers/protobuf/releases
unzip it in somewhere in your PATH . for example you can do something like this : $ unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
DONE !
What I ended up doing in same situation was to include
message google {
message protobuf {
message Timestamp {
int64 seconds = 1;
int32 nanos = 2;
}
}
}
In my proto-file. That was enough for it to be recognized as well known type, so in python I get the addition API described at https://developers.google.com/protocol-buffers/docs/reference/python-generated#timestamp.
The main advantage is that we all can keep using the system install of protoc and don't have to install from source.

Why is /var/lib/dpkg/status missing on a BitBake-generated OS?

I have installed apt onto a system built by BitBake by adding the apt package to the IMAGE_INSTALL variable in my recipe.
apt-get and apt-cache now execute on the built system, but if I try to do anything useful with them (such as apt-get update or apt-cache search), I get the following error:
E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory)
E: The package lists or status file could not be parsed or opened
After some preliminary searching, I found this exchange on the Yocto Project mailing list:
Hi,
I have some requirement with apt-get in yocto genearted rootfs.
I built the yocto source code with enabling the apt package.
But after booting the image on my machine and run the "apt-get" command for installing some package it gives the following error.
Could not open the file /var/lib/dpkg/status open(2: no such a file or directory).
The package lists or status files could not be parsed or opened.
This error is because you need to add package-management to EXTRA_IMAGE_FEATURES in local.conf,
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
I've added package-management but don't see any different output.
After a touch /var/lib/dpkg/status, apt-get update returns the following:
Reading package lists...Done
How can I get apt into a functioning state through the use of BitBake metadata?
I have found a similar thread from the NXP website.
You would need to set up your own web server and provide all those packages and add the server URL to the source list. SourceList
In addition, you have to update the package manifest by running bitbake package-index and add PACKAGE_CLASSES ?= " package_deb" to conf/local.conf
I have successfully set up OPKG before. The steps are similar, you can find it here

How to install Net::SSH2 from CPAN on Cygwin

I needed to install Net:SSH2 in a Cygwin environment under Windows 7 (64 bit). As usually I tried to install it with cpanm.
I already had the necessary Cygwin packages (see below) installed but the Perl build failed because it couldn't find the libssh2 library.
There is a special text file BUILDING.WIN32 in the Net::SSH2 package but this is only useful when building the module by hand and it refers mainly to MinGW. So this no help.
This is the log of the build:
Entering Net-SSH2-0.53
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.59 ... Yes (7.02)
Running Makefile.PL
Configuring Net-SSH2-0.53 ... Subroutine checklibs redefined at inc/Module/Install/CheckLib.pm line 11.
Subroutine assertlibs redefined at inc/Module/Install/CheckLib.pm line 25.
Subroutine _author_side redefined at inc/Module/Install/CheckLib.pm line 39.
The libssh2 library is required by this module. If you don't have it, you can
download it from http://www.libssh2.org; you may also need OpenSSL, which can
be obtained from http://www.openssl.org , or libgcrypt, which can be obtained
from http://www.gnupg.org .
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
You can pass your libssh2 lib and include dirs (and extra link args) on the
command line. E.g.:
perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include \
ldargs="-lz"
These can also be set through the LIBSSH2_LIB/LIBSSH2_INCLUDE/LIBSSH2_LDARGS
environment variables.
To build with libgcrypt instead of OpenSSL, pass 'gcrypt' as a parameter to
Makefile.PL, e.g.:
perl Makefile.PL gcrypt
If you want to build on Windows, see the file BUILDING.WIN32 in the
distribution.
Can't link/include C library 'ssh2', aborting.
First install the libssh2-devel package from Cygwin, e.g. with apt-cyg the command line frontend for installing packages from within a cygwin shell.
apt-cyg install libssh2-devel
Then set some environment variables to the right path for getting Net::SSH2 to work with the Cygwin packages:
LIBSSH2_LIB=/usr/lib/ LIBSSH2_INCLUDE=/usr/include/ cpanm -v Net::SSH2
That worked for me. Much easier than what the readme file linked above looked like.

Resources