Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jean-christophe-manciot opened this issue Dec 21, 2021 · 14 comments · Fixed by #2207 or GNS3/gns3-gui#3457
Labels
Milestone

Comments

@jean-christophe-manciot

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
Copy link
Member

grossmj commented Dec 21, 2021

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

@b-ehlers
Copy link

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 GNS3/gns3-gui#2919 (comment)

@jean-christophe-manciot
Copy link
Author

@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

@grossmj
Copy link
Member

grossmj commented Dec 24, 2021

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

@jean-christophe-manciot
Copy link
Author

jean-christophe-manciot commented Dec 24, 2021

@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 grossmj added this to the 2.2.30 milestone Dec 28, 2021
@grossmj
Copy link
Member

grossmj commented Jan 15, 2022

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

@grossmj grossmj modified the milestones: 2.2.30, TBD Jan 15, 2022
@jean-christophe-manciot
Copy link
Author

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

@animesh-jha96
Copy link

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

@jean-christophe-manciot
Copy link
Author

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

@aniruddhakal
Copy link

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
Copy link
Member

grossmj commented Nov 6, 2022

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 #1918

@grossmj
Copy link
Member

grossmj commented Nov 6, 2022

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 grossmj modified the milestones: 2.2.35, 2.2.36 Nov 6, 2022
@grossmj grossmj modified the milestones: 2.2.36, 2.2.37 Jan 2, 2023
@grossmj grossmj modified the milestones: 2.2.37, 3.0 Jan 17, 2023
This was linked to pull requests Mar 21, 2023
@grossmj
Copy link
Member

grossmj commented Mar 21, 2023

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

@grossmj grossmj closed this as completed Mar 21, 2023
@grossmj
Copy link
Member

grossmj commented Mar 21, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants