Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

git clone https://github.com/pandas-dev/pandas.git
cd pandas
python3 setup.py build_ext --inplace

Issue Description

The above raises

Traceback (most recent call last):
  File "/tmp/pandas/setup.py", line 666, in <module>
    version=versioneer.get_version(),
  File "<string>", line 1800, in get_version
  File "<string>", line 1732, in get_versions
  File "<string>", line 396, in get_config_from_root
  File "/usr/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.9/configparser.py", line 1149, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'versioneer'

Expected Behavior

This command has always worked, at least until April.

I have tried to understand what to do from https://github.com/python-versioneer/python-versioneer , and it says that the section is required in setup.cfg or pyproject.toml (and we have the latter). So not sure why it fails. In any case, copypasting the section also to setup.cfg and running versioneer install --no-vendor gives:

/home/nobackup/repo/pandas
 creating "pandas/_version.py"
Traceback (most recent call last):
  File "/home/pietro/.local/bin/versioneer", line 8, in <module>
    sys.exit(main())
  File "/home/pietro/.local/lib/python3.9/site-packages/versioneer.py", line 1932, in main
    setup_command()
  File "<string>", line 2197, in setup_command
  File "<string>", line 2118, in do_setup
FileNotFoundError: [Errno 2] No such file or directory: '"pandas/_version.py"'

... which is to me even more weird - pandas/_version.py is definitely there.

I guess this might be related to https://github.com/pandas-dev/pandas/pull/49924 , but I hadn't compiled pandas since months, so I'm not sure.

Installed Versions

Notice that the commit is wrong. I'm on 7d2337a34828e3ed645498d0ea37ca9ceb3fa31a , which however I can't compile. Also notice that versioneer is 0.28. Also notice that the bug is not tested with the last version of pandas - it's in git only. However if I don't check the box at the top it won't let me submit the issue.

INSTALLED VERSIONS ------------------ commit : 4bfe3d07b4858144c219b9346329027024102ab6 python : 3.9.2.final.0 python-bits : 64 OS : Linux OS-release : 5.18.0-0.deb11.4-amd64 Version : #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1~bpo11+1 (2022-08-12) machine : x86_64 processor : byteorder : little LC_ALL : None LANG : it_IT.UTF-8 LOCALE : it_IT.UTF-8 pandas : 1.4.2 numpy : 1.23.3 pytz : 2021.1 dateutil : 2.8.2 pip : 20.3.4 setuptools : 52.0.0 Cython : 0.29.32 pytest : 6.0.2 hypothesis : 5.43.3 sphinx : 3.4.3 blosc : 1.9.2 feather : None xlsxwriter : 1.1.2 lxml.etree : 4.6.3 html5lib : 1.1 pymysql : None psycopg2 : 2.8.6 jinja2 : 2.11.3 IPython : 7.20.0 pandas_datareader: None bs4 : 4.8.2 bottleneck : 1.3.4 brotli : 1.0.9 fastparquet : None fsspec : 0.8.4 gcsfs : None markupsafe : 1.1.1 matplotlib : 3.3.4 numba : None numexpr : 2.7.2 odfpy : None openpyxl : 3.0.3 pandas_gbq : None pyarrow : None pyreadstat : 1.1.0 pyxlsb : None s3fs : None scipy : 1.6.0 snappy : None sqlalchemy : 1.3.22 tables : 3.6.1 tabulate : None xarray : 0.16.1 xlrd : 2.0.1 xlwt : 1.3.0 zstandard : None

Comment From: MarcoGorelli

versioneer has been added to environment.yml and requirements-dev.txt, you'll need to re-build your environment

Comment From: toobaz

versioneer has been added to environment.yml and requirements-dev.txt, you'll need to re-build your environment

I do have versioneer installed. What environment do you refer to? I'm just doing the above in a shell, with all required dependencies installed.

Comment From: MarcoGorelli

your development environment

can you try to install versioneer[toml]?

either that, or try clearing non-tracked files git clean -fxfd pandas

building from source definitely works, we did a couple of sprints last week

Comment From: toobaz

can you try to install versioneer[toml]?

Aha, that was it. Sorry for the noise, I had no idea it was a different package altogether.

Comment From: ChristopherDavisUCI

This thread was helpful to me, thank you! In my Mac terminal, I had to put quotation marks around versioneer[toml], so I had to type pip install 'versioneer[toml]'. Just wanted to post that in case anyone else is stuck in the same place.