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

Install instructions/setup.py should recommend non-root install #9

Open
pacohope opened this issue Nov 14, 2023 · 4 comments
Open

Install instructions/setup.py should recommend non-root install #9

pacohope opened this issue Nov 14, 2023 · 4 comments

Comments

@pacohope
Copy link
Contributor

pacohope commented Nov 14, 2023

Hi there, (sorry, somehow submitted before I was done typing)

The installation instructions suggest running sudo python3 setup.py. That's definitely not the way to do python development. This is not a system-level utility that needs to run as root, so it should be possible to install without any privileges at all.

If you run python3 -m venv .venv and then . .venv/bin/activate, you get a unique virtual python environment that needs no privileges whatsoever to install. It's just in your own personal directory, and things installed by pip can easily be installed because they're just going into your home directory (where you don't need root privileges to write files).

Having said that, running python3 setup.py install produces a lot of warnings like this:

python3 setup.py install
/Users/pacohope/lib/python3/lib/python3.12/site-packages/setuptools/_distutils/dist.py:265: UserWarning: Unknown distribution option: 'status'
  warnings.warn(msg)
running install
/Users/pacohope/lib/python3/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!

At the end of setup.py's output, I get this error:

Processing dependencies for plann==0.15.1
Searching for sortedcontainers
Reading https://pypi.org/simple/sortedcontainers/
Download error on https://pypi.org/simple/sortedcontainers/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) -- Some packages may not be found!
Couldn't find index page for 'sortedcontainers' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) -- Some packages may not be found!
No local packages or working download links found for sortedcontainers
error: Could not find suitable distribution for Requirement.parse('sortedcontainers')

Somehow I still seem to have a plann script in my path, but when I run it, I see:

Traceback (most recent call last):
  File "/Users/pacohope/lib/python3/bin/plann", line 33, in <module>
    sys.exit(load_entry_point('plann==0.15.1', 'console_scripts', 'plann')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pacohope/lib/python3/bin/plann", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/pacohope/lib/python3/lib/python3.12/site-packages/plann-0.15.1-py3.12.egg/plann/cli.py", line 24, in <module>
ModuleNotFoundError: No module named 'caldav'

The dependencies don't appear to be captured properly. It is depending on a module that I don't have installed, but the setup program didn't cause me to install it. This is also a reason not to do sudo setup.py install because you modify your entire operating system. It's hard to wipe the environment clean for testing. But if you use a virtual environment, you can trivially run rm -rf .venv and wipe it out clean. Then run python3 -m venv .venv and create a fresh environment. That way it's easy to test whether all the dependencies are installed on a clean system.

Somehow I seem to have gotten a plann script installed, but

@pacohope
Copy link
Contributor Author

Ok. So, the SSL certificate issue was a screw-up in my personal installation. Once I fixed the certifi library and got the right certificates installed, the setup.py does the right thing. I'm sorry. My mistake.

I still see the following errors when running, but it seems to run:

$ plann
/Users/pacohope/lib/python3/lib/python3.12/site-packages/vobject-0.9.6.1-py3.12.egg/vobject/base.py:736: SyntaxWarning: invalid escape sequence '\-'
/Users/pacohope/lib/python3/lib/python3.12/site-packages/vobject-0.9.6.1-py3.12.egg/vobject/base.py:1219: SyntaxWarning: invalid escape sequence '\;'
/Users/pacohope/lib/python3/lib/python3.12/site-packages/vobject-0.9.6.1-py3.12.egg/vobject/base.py:1219: SyntaxWarning: invalid escape sequence '\,'
/Users/pacohope/lib/python3/lib/python3.12/site-packages/vobject-0.9.6.1-py3.12.egg/vobject/base.py:736: SyntaxWarning: invalid escape sequence '\-'
/Users/pacohope/lib/python3/lib/python3.12/site-packages/vobject-0.9.6.1-py3.12.egg/vobject/base.py:1219: SyntaxWarning: invalid escape sequence '\;'
/Users/pacohope/lib/python3/lib/python3.12/site-packages/vobject-0.9.6.1-py3.12.egg/vobject/base.py:1219: SyntaxWarning: invalid escape sequence '\,'
Usage: plann [OPTIONS] COMMAND [ARGS]...

  CalDAV Command Line Interface, in development.

So it seems to be running more or less correctly, but these vobject warnings are unexpected.

I still think there's no reason to install something like this with sudo.

@tobixen
Copy link
Owner

tobixen commented Nov 14, 2023

I'm having vobject-0.9.6.1installed myself and can't see those errors ... but apparently I'm at python 3.11, perhaps that's the reason? In any case, I think this is an issue with vobject rather than plann. vobject is pulled in as a dependency from the caldav library. The caldav library is mostly utilizing icalendar rather than vobject, but vobject support is still there for backward-compatibility reasons. Perhaps I should clean out the last references to vobject in the caldav library and declare it as an optional dependency.

I'd happily merge a pull request that improves on the installation part - but I consider it to be a requirement that it's possible to install the plann-tool system-wide (and that the process of doing this is documented).

@pacohope pacohope changed the title Install instructions/setup.py broken Install instructions/setup.py should recommend non-root install Nov 15, 2023
@raffaem
Copy link

raffaem commented Jan 31, 2024

setup.py is outdated. Should use project.toml.

@tobixen
Copy link
Owner

tobixen commented Jan 31, 2024

setup.py is outdated. Should use project.toml.

New merge-request is appreciated :-)

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

No branches or pull requests

3 participants