Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

pip install twofish fails in python 3.8 #10

Open
aworldofcode opened this issue May 23, 2022 · 3 comments
Open

pip install twofish fails in python 3.8 #10

aworldofcode opened this issue May 23, 2022 · 3 comments

Comments

@aworldofcode
Copy link

The installation of twofish fails
Any help ?

`pip install twofish
Collecting twofish
Using cached twofish-0.3.0.tar.gz (26 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: twofish
Building wheel for twofish (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
copying twofish.py -> build/lib.linux-x86_64-cpython-38
running build_ext
building '_twofish' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/twofish-0.3
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Itwofish-0.3 -I/opt/awx_envs/ansible_5/include/python3.8 -c twofish-0.3/twofish.c -o build/temp.linux-x86_64-cpython-38/twofish-0.3/twofish.o
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Itwofish-0.3 -I/opt/awx_envs/ansible_5/include/python3.8 -c twofish.c -o build/temp.linux-x86_64-cpython-38/twofish.o
twofish.c:11:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for twofish
Running setup.py clean for twofish
Failed to build twofish
Installing collected packages: twofish
Running setup.py install for twofish ... error
error: subprocess-exited-with-error

× Running setup.py install for twofish did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running install
/opt/awx_envs/ansible_5/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
copying twofish.py -> build/lib.linux-x86_64-cpython-38
running build_ext
building '_twofish' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/twofish-0.3
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Itwofish-0.3 -I/opt/awx_envs/ansible_5/include/python3.8 -c twofish-0.3/twofish.c -o build/temp.linux-x86_64-cpython-38/twofish-0.3/twofish.o
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Itwofish-0.3 -I/opt/awx_envs/ansible_5/include/python3.8 -c twofish.c -o build/temp.linux-x86_64-cpython-38/twofish.o
twofish.c:11:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> twofish

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
`

@Peastaria
Copy link

Hi, also saw the issue you raise on

kurtbrose/pyjks#74

Turn out I found that in twofish.c, line 11

#include <Python.h>

is unable to find the Python dev. library in /usr/include/

You might have to modify it to the absolute path having the Python dev. library. For me, it is on

/usr/include/python3.5m/Python.h

;in which line 11 should modify to

#include "/usr/include/python3.5m/Python.h"

After that, the bridge program should be able to compile later when install.

Finally, rebuild the TarBall and install it manually by

pip install twofish-0.3.0.tar.gz

It would works!

@shakil18
Copy link

I had issue with python3.11. I found i had no Python dev for 3.11. After installing the 'python3.11-dev', it was worked.
library in: /usr/include/
dev package: https://www.ubuntuupdates.org/package/core/jammy/universe/proposed/python3.11-dev

@Pathakvishnu
Copy link

Collecting twofish
Using cached twofish-0.3.0.tar.gz (26 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: twofish
Building wheel for twofish (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for twofish
Running setup.py clean for twofish
Failed to build twofish
ERROR: Could not build wheels for twofish, which is required to install pyproject.toml-based projects

I am facing the same error in windows, any workaround?

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

No branches or pull requests

4 participants