GNS3 / gns3-server

GNS3 server
GNU General Public License v3.0
811 stars 263 forks source link

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

Closed jean-christophe-manciot closed 1 year ago

jean-christophe-manciot commented 2 years ago

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?

grossmj commented 2 years ago

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

ghost commented 2 years ago

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

jean-christophe-manciot commented 2 years ago

@grossmj Thanks, except that the following command installs into /usr/lib/python3.9/site-packages instead of /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.

grossmj commented 2 years ago

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

jean-christophe-manciot commented 2 years ago

@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.
grossmj commented 2 years ago

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

jean-christophe-manciot commented 2 years ago

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

animesh-jha96 commented 2 years ago

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

jean-christophe-manciot commented 2 years ago

No, still the same with:

aniruddhakal commented 2 years ago

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!

grossmj commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

We have migrated to pyproject.toml. Setup.py shouldn't be used directly anymore.

grossmj commented 1 year ago

More info on https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html