pypa / packaging-problems

An issue tracker for the problems in packaging
146 stars 34 forks source link

Trouble following packaging libraries tutorial #375

Open wkailey opened 4 years ago

wkailey commented 4 years ago

Thank you for providing feedback on Python packaging!

To help us help you, please fill out as much of the following as you can. If a question is not relevant, feel free to skip it.

  1. What is your operating system and version? OpenSuse 15.1 Linux

  2. What is your Python version? 3.8

  3. What version of pip do you have? pip 20.1.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

  1. If following an online tutorial or guide, please provide a link to the page or section giving you trouble: https://packaging.python.org/tutorials/packaging-projects/

  2. Could you describe your issue in as much detail as possible? I was following the tutorial step-by-step without problems, until I got to the step where you run setup.py. Here's what happened (Note: I use a two-line prompt that gives my working directory above the OS prompt): /home/wkailey/dev/pppt/packaging_tutorial wkailey@lagrange$ python3 setup.py sdist bdist_wheel Traceback (most recent call last): File "setup.py", line 1, in import setuptools File "/usr/local/lib/python3.8/site-packages/setuptools/init.py", line 23, in from setuptools.dist import Distribution File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 34, in from setuptools import windows_support File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in import ctypes File "/usr/Python-3.8.0/Lib/ctypes/init.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'

/home/wkailey/dev/pppt/packaging_tutorial wkailey@lagrange$

I did this with my already-installed version of pip, but when you asked about the pip version, I did this to get to the latest version, which also failed in the same way: /home/wkailey/dev/pppt/packaging_tutorial root@lagrange$ pip install -U pip (NOTE: the update to pip did succeed, but when I exited from superuser and repeated the setup.py step, it failed again in the same way as before).

Thanks for any help.

merwok commented 4 years ago

How was the Python installed? /usr/Python-3.8.0 doesn’t look like a normal system install, more like what I would expect to see for a custom install in /opt, but I don’t know if that’s normal for OpenSuse.

The Python install seems to miss the built-in _ctypes module. If it’s a system install, maybe you need to install an extra package named something like python3.8-ctypes. If you did the build, maybe you didn’t have all build dependencies installed.

wkailey commented 4 years ago

Thanks. Any pointers on how to install _cytpes? Will pip do that for me? I'll try that first, I guess.

In answer to your question, I installed it myself. Probably used zypper and a downloaded rpm. I probably got the rpm from python.org or an OpenSuse open source repository. I don't recall the specifics, though.

wkailey commented 4 years ago

'pip install _ctypes' did not work. Obviously, there's more to it than that. Would appreciate specifics on how to install _ctypes. Thanks.

wkailey commented 4 years ago

Update: I built and installed python3.8 by downloading the source code from python.org. I installed it in the default location and deleted my previous installation in /usr/local/bin.

I noticed that during 'make test' (which is one of the build and install steps found in the README.rst), there was a message about the ctypes test being skipped.

Next I logged in as myself (rather than root), did 'python3 --version' and some 'which' commands to verify that I was using the newly installed version (I was) and tried this command again. It again failed with ModuleNotFoundError: No module named '_ctypes'

I guess that means that 'make configure' or someone decided that OpenSuse Linux 15.1 cannot support the ctypes package? Does this mean that I cannot use the packaging system from my Linux distribution? I hope not, but I would welcome any further information you have about what the limitation of "no ctypes" will mean in terms of packaging and distribution for my application.

Cordially,

Walt

merwok commented 4 years ago

See my previous message:

The Python install seems to miss the built-in _ctypes module. If it’s a system install, maybe you need to install an extra package named something like python3.8-ctypes.

It’s a module part of the standard library, it comes with Python, you can’t install with pip.

If you did the build, maybe you didn’t have all build dependencies installed.

uranusjr commented 4 years ago

You may find pyenv/pyenv#1183 informative.