Encountering errors while installing the pyfstat in vs code

Hello Everyone, has anyone installed PyFstat module in vs code? I am encountering erros while trying to install this module. So, I’m looking for suggestions.

Here is the error message;
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [202 lines of output]
setup.py:67: RuntimeWarning: NumPy 1.19.5 may not yet support Python 3.10.
Running from numpy source directory.
setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
Cythonizing sources
Processing numpy/random_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Processing numpy/random\mtrand.pyx
Processing numpy/random_bounded_integers.pyx.in
Processing numpy/random_common.pyx
Processing numpy/random_generator.pyx
Processing numpy/random_mt19937.pyx
Processing numpy/random_pcg64.pyx
Processing numpy/random_philox.pyx
Processing numpy/random_sfc64.pyx
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler

I already installed the different version of numpy but still it didn’t work out.

Hi, PyFstat maintainer here. At first glance, this looks more like a numpy issue, since we haven’t actually migrated to a pyproject.toml for our setup. Also the quoted numpy version is much older than the one we have pinned as a PyFstat dependency (<1.24.0). Could you please clarify:

  • Is this in a clean environment of some type (venv or conda), and trying to install via pip or conda? (I’ve never tried to use vscode for installing something, so I don’t know what it does in the backend.)
  • Which was the “different version of numpy” you’ve tried?

Hi David, glad to hear from you. I have tried with NumPy version 1.23.5, and I am using Python 3.11.2. I used the following command: pip install --user pyfstat because I am using Jupyter Notebook. For your reference, I am attaching the screenshots.

In a conda environment with python 3.11.2, I’m able to pip install pyfstat, it pulls in numpy-1.23.5 as expected and seems to work. Differences and possible issues between what you and I are doing:

  • Is the jupyter server running on your own computer or a remote access?
  • Is your python the system-installed version or in a conda env?
  • You use the --user flag, which I would discourage, because it leaves hard-to-track-down installations in your home directory. Using either conda (see conda environments · PyFstat/PyFstat Wiki · GitHub ) or at least a classic venc (python -m venv myenvname) is highly recommended.

Hi David, I am running Jupyter on my own computer in VS Code. Since VS Code provides the Jupyter notebook, I have the system-installed Python version. I used the --user flag because earlier I tried without this and was getting errors, so I used the --user flag.

As another data point, I managed to install pyfstat with python 3.11.7 and numpy==1.23.5 in a clean virtual environment.

My best guess is that this probably has to do with the way VS Code manages Jupyter notebook kernels.

Can you post a pip list output from the same session?

Alternatively, you could try creating a clean environment in a separate terminal, then try to get vscode/jupyter to load the kernel from there. There are some instructions on how to do so with conda/mamba in the “enabling jupyter notebooks” section on the wiki I linked above, but I’ve not tried to combine such a setup with vscode.

Hello David, I have successfully combined the Conda environment with my VS Code, but I am still encountering the same errors. Here is the pip list;
Package Version

asttokens 2.2.1
backcall 0.2.0
colorama 0.4.6
comm 0.1.3
debugpy 1.6.7
decorator 5.1.1
executing 1.2.0
ipykernel 6.22.0
ipython 8.12.0
jedi 0.18.2
jupyter_client 8.1.0
jupyter_core 5.3.0
matplotlib-inline 0.1.6
nest-asyncio 1.5.6
packaging 23.0
parso 0.8.3
pickleshare 0.7.5
pip 23.3.1
platformdirs 3.2.0
prompt-toolkit 3.0.38
psutil 5.9.4
pure-eval 0.2.2
Pygments 2.14.0
python-dateutil 2.8.2
pywin32 306
pyzmq 25.0.2
setuptools 68.2.2
six 1.16.0
stack-data 0.6.2
tornado 6.2
traitlets 5.9.0
wcwidth 0.2.6
wheel 0.41.2

So there appears to be no other pre-installed numpy version visible to pip that could conflict, at least. However I’ve seen before that versions from /home/username/.local can interfer even with what I thought would be cleanly isolated conda envs.

To be entirely sure that is not the direction the issue is in:

  • is that pip list from inside the same notebook you’re trying to do the installation in, just before issuing the install command?
  • at the same moment, does import numpy fail? If it works, what is numpy.__file__?

Otherwise, I don’t have a good idea of what might be going wrong. But the one other thing you could try is conda install -c conda-forge pyfstat instead.

I think pyfstat requires specific versions of packages that may conflict with the ones you already have installed. I installed it creating a new environment as suggested on their webpage and did not have problems running it.