Numpy_financial unavailable for dnf install

As of NumPy 1.20.0, the financial functions (e.g., fv, npv) have been moved to numpy_financial. I can dnf install python3-numpy, but I can’t find a numpy_financial module on the Fedora repository. I am using Fedora 36. Is there another repository that I can use, via dnf, to install numpy_financial? Thanks

1 Like

I suggest you use a virtual environment:

python -m venv env
source env/bin/activate

Then use pip to install it from there. I strongly recommend you install python libraries sourced with pip (or conda/mamba) in a virtual env like this and never as root. Another option is to use a container or toolbox.

1 Like

I am new to Fedora, but I will look into the use of virtual environments. Thanks

2 Likes

I maintain data science (Jupyter, etc) environments in my dayjob, for what it’s worth, and I do all of this stuff in containers.

Here’s an example from one I maintain that’s itself based on Jupyter upstream that’s probably way more than you would need, but you could always base your own container from it and run it on Fedora: GitHub - UCSB-PSTAT/jupyter-base: Jupyter Notebooks optimized for use with JupyterHub

1 Like

If they’ve been split out into a new package, someone will need to package it up to make it available in Fedora.

Some more info on how new packages are included in Fedora is here:

1 Like

I setup a virtual environment, pip installed my python packages, and activated the virtual environment. All seemed good, then…
I running Fedora 36 as a guest OS using VMWare Fusion 12.1.2. After setting up my virtual environment for python, the open-vm-tools quit unexpectedly. I tried reinstalling open-vm-tools but was informed it was already installed.
Screen Shot 2022-08-26 at 9.34.54 AM

Is it possible the creation and activation of my virtual environment for python is causing this problem? I did not have this problem prior to creating it.

So, stuff you install from the Fedora repositories is built against the system python version, and the versions of python libraries in the repositories. We call these “system packages”. These cannot be mixed with packages you install in your virtual environment. They should be kept separate.

It’s hard to say if open-vm-tools were affected by the virtual env, but unless you need numpy_financial with your open-vm-tools, you should deactivate the virtual env before using them. I.e., enable your virtual env when you need numpy_financial, and then disable it when you’re done.

1 Like