gns3-server icon indicating copy to clipboard operation
gns3-server copied to clipboard

setup.py install is deprecated. Use build and pip and other standards-based tools

Open jean-christophe-manciot opened this issue 3 years ago • 10 comments

python3.9 3.9.9-1 distutils 3.9.9-3 setuptools: 60.0.3

Building gns3-gui/server from source throws a Setuptools deprecation warning:

python3.9 setup.py install --root="../gns3-gui-build" --single-version-externally-managed
running install
/usr/local/lib/python3.9/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

Is there another way to build gns3 from source?

jean-christophe-manciot avatar Dec 21 '21 11:12 jean-christophe-manciot

I think now you should use pip: python3 -m pip install <path>

Alternatively, you could install from VCS, something like python3 -m pip install -e git+https://github.com/GNS3/gns3-server

grossmj avatar Dec 21 '21 12:12 grossmj

I'm doing GNS3 installations via pip since the early 2.2 days and it's working great.

Main reason is, that the pip installation uses a location for the share folder, that I like better than the location used by setup.py, see https://github.com/GNS3/gns3-gui/issues/2919#issuecomment-572760953

b-ehlers avatar Dec 21 '21 12:12 b-ehlers

@grossmj Thanks, except that the following command installs into <root_folder>/usr/lib/python3.9/site-packages instead of <root_folder>/usr/lib/python3/dist-packages

python3 -m pip install . --root="../gns3-gui-build" --prefix=/usr

I tried to add the following option but it seems to be unsupported:

--install-option='--install-purelib="../gns3-gui-build/usr/lib/python3/dist-packages"'

Any suggestion?

@b-ehlers Thanks, but my goal is to build deb packages for systemd distributions, not just install gns3.

  • /lib/systemd/system/gns3.service necessary on systemd distributions is not provided by pypi.
  • also, system-level python3 deb packages are installed into /usr, not /usr/local

jean-christophe-manciot avatar Dec 21 '21 15:12 jean-christophe-manciot

@jean-christophe-manciot maybe something like python3 -m pip install . --install-option='--prefix=<install-dir>'? (untested)

grossmj avatar Dec 24 '21 00:12 grossmj

@grossmj Unfortunately, despite what is stated in 'Installing Python Modules (Legacy version) Doc' and 'pip install doc', all --install-option seem unsupported.

With build-requirements.txt:

. --install-option="--install-purelib=/usr/lib/python3/dist-packages"
python3 -m pip install . --root="../gns3-gui-build" --prefix=/usr -r build-requirements.txt

/usr/local/lib/python3.9/dist-packages/pip/_internal/req/req_file.py:191: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
  cmdoptions.check_install_build_global(options, line.opts)
ERROR: Location-changing options found in --install-option: ['--install-purelib'] from file:///git-gns3-gui (from -r build-requirements.txt (line 1)). This is unsupported, use pip-level options like --user, --prefix, --root, and --target instead.

jean-christophe-manciot avatar Dec 24 '21 09:12 jean-christophe-manciot

@jean-christophe-manciot let us know if you find an alternative.

grossmj avatar Jan 15 '22 08:01 grossmj

@grossmj I haven't yet; I have also posted this on stackoverflow, but there is no progress yet.

jean-christophe-manciot avatar Jan 15 '22 13:01 jean-christophe-manciot

@jean-christophe-manciot were you able to solve it?

animesh-jha96 avatar Feb 22 '22 14:02 animesh-jha96

No, still the same with:

  • python3.9 3.9.10-1
  • python3-distutils 3.9.10-1
  • setuptools 60.9.3
  • pip 22.0.3

jean-christophe-manciot avatar Feb 22 '22 18:02 jean-christophe-manciot

I think now you should use pip: python3 -m pip install <path>

Alternatively, you could install from VCS, something like python3 -m pip install -e git+https://github.com/GNS3/gns3-server

This seems like a clean way to do it. Worked for me. Thanks!

aniruddhakal avatar Mar 22 '22 13:03 aniruddhakal

Thanks, but my goal is to build deb packages for systemd distributions, not just install gns3.

We have plans to allow the installation of our gns3-server Debian package as a service. Please see https://github.com/GNS3/gns3-server/issues/1918

grossmj avatar Nov 06 '22 10:11 grossmj

Is there another way to build gns3 from source?

https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#source-distributions

The new recommended way is by using build, for example: python3 -m build --sdist

grossmj avatar Nov 06 '22 11:11 grossmj