I installed python 3.8.2 using xcode command line tools but now according to this article I should remove it to download Miniforge3. I didn't know how to do it so now I encountered this error when I ran command
file $(which python)
architecture error
According to the article and some online sources, it should only show arm64 but mine showed arm64e. When I navigated to condabin folder and try running conda init it crashed.
I think I should remove Python3 and start Miniforge installation process again, but I don't know how to delete it. I tried
sudo rm -rf /usr/bin/python3
but it said: Operation not permitted
I used
./configure --prefix=$HOME
make
make install
to install sdl2,
after which I tried to install pygame by
cd ../pygame-1.9.1release/
python setup.py install
but I am getting an error:
linuxnx:~/python/library/pygame-1.9.1release> python setup.py install
WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...
Hunting dependencies...
sh: sdl-config: command not found
WARNING: "sdl-config" failed!
sh: smpeg-config: command not found
WARNING: "smpeg-config" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.
I searched a long time, cause I needed the package for Python Crash Course by Eric Matthes, but couldn't find the answer that would help running
pip install pygame
without errors and finally found 1 line solution that worked for me
sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev
I'm seeing that this thread has been around for a long time, but I think it's a good idea to leave this here in case it helps someone.
I found these lines on a website that might help:
At the moment, 5/1/2020, you cannot install the pygame libraries in
python 3.8 with pip install pygame, bu you can install them with a
particular version of them, still for dev. You can install Python 3.8
in the command line using this version: pip install pygame==2.0.0.dev6
Latest version: pip install pygame==2.0.0.dev10
I don't know if you use python3 but it throws me more errors apart from sdl
as well as freetype-config ... Before I used "python3 -m pip install pygame".
:~$ python3 -m pip install pygame==2.0.0.dev10
Collecting pygame==2.0.0.dev10
Downloading pygame-2.0.0.dev10-cp38-cp38-manylinux1_x86_64.whl (14.3 MB)
|████████████████████████████████| 14.3 MB 130 kB/s
Installing collected packages: pygame
Successfully installed pygame-2.0.0.dev10
Nice programming time for all!! =)
ORIGINAL: 2013.10.25
PyGame-1.9.1 was created in 2009 so it still use old SDL 1.2 not new SDL2.
PySDL2 use SDL2
EDIT: 2021.10.17
Question and my original answer is almost 8 years old and it seems author removed PySDL2 from URL in my old answer. He moved code from bitbucket to github
Using Google I found
doc: https://pysdl2.readthedocs.io/
pypi: https://pypi.org/project/PySDL2/
github: https://github.com/marcusva/py-sdl2
And meanwhile PyGame started to use SDL2.
Pygame.org: pygame 2 — 28 Oct, 2020
GitHub: Release note
See also all releases
Try this in the terminal , It should installs the sdl 1.2
# make a temporary directory where we can download and build stuff
mkdir tmp
cd tmp
# download and install SDL
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure
sudo make all
After I read top answer above,
I installed python-dev, libsdl-image1.2-dev.
Then I got
Hunting dependencies...
WARNING: "pkg-config freetype2" failed!
WARNING: "freetype-config" failed!
SDL : found 1.2.15
FONT : not found
IMAGE : found
MIXER : not found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: not found
Missing dependencies
So I just installed these and it worked.
sudo apt install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libportmidi-dev libfreetype6-dev
This error showed up once again in Pygame-2.0.0.dev12
The solution for me was:
sudo apt-get install libsdl2-dev
Then I got
Hunting dependencies...
SDL : found 2.0.9
FONT : not found
IMAGE : not found
MIXER : not found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: found
PORTTIME: found
FREETYPE: found 22.1.16
So I ran this command below:
sudo apt-get install libsdl2-mixer-dev libsdl2-image-dev libsdl2-ttf-dev
To wrap up the missing dependencies
First of all I am very new to cygwin and I didn't find similar question
It was pointed out that to install Python lib hdt that contains c++ code it is necessary to use Cygwin because some headers exist only in Posix.
Trying to install the lib earlier I installed MS BuildTools. When I tried to install the lib without Cygwin on Windows it was an error
BitSequence.cpp
hdt-cpp-1.3.3/libcds/include/libcdsBasics.h(27): fatal error C1083: ЌҐ г¤ Ґв
бп ®вЄалвм д ©« ўЄ«о票Ґ: sys/resource.h: No such file or directory,
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Buil
dTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exi
t status 2
The error is from C:\Program Files (x86)\Microsoft Visual Studio
And I've find out that there is no way to avoid the error on Windows, and in won't be the error on Linux or using Cygwin.
Now I try to install Python lib in Cygwin. I do the same in Cygwin terminal (pip install hdt) and get the same error from Visual Studio.
Why doesn't Cygwin use gcc? I think that's a point of Cygwin usage. Of course if it uses VS it gets the same error.
I bet you are NOT using the cygwin Python and using instead a windows Version:
$ which pip
which: no pip in (/home/Marco/bin:/usr/local/bin:/usr/bin:/usr/lib/lapack:/usr/sbin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/d/utility)
$ which pip2
/usr/bin/pip2
$ which pip3
/usr/bin/pip3
Verify you have installed a Cygwin Python,
$ cygcheck -cd |grep "python3. "
python3 3.8.3-1
python36 3.6.10-1
python37 3.7.7-1
python38 3.8.3-1
$ cygcheck -cd |grep "python2. "
python2 2.7.18-1
python27 2.7.18-1
and try again with EG
Usage:
/usr/bin/python3.6 -m pip <command> [options]
/usr/bin/python3.6 -m pip install hdt
While following an online tutorial to create a Flask web-app, I was trying to install flask-mysqldb with sudo pip3 install flask-mysqldb. This results in an installation error which seems to stem from a dependency problem. The error message is as follows Command "/usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-nbajn5in/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-_eid7ul7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-nbajn5in/mysqlclient/
I have not been able to find any resources indicating a way forward outside of abandoning flask-mysqldb in favour of another module. Thanks
Thanks to those who replied, I employed a workaround by downloading another flask module (flask-mysql) and used that to access my MySQL DB.
If you encounter this issue and wish to implement flask-mysql instead of flask-mysqldb follow the instructions here https://flask-mysql.readthedocs.io/en/latest/# .
The installation error remains unsolved and I'll log it with the flask-mysqldb people.
Regards.
I had the same issue it worked fine after installing:
sudo apt-get install libmysqlclient-dev
# make sure all essentials are there
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
How to get / install ansible using Cygwin?
I tried the following steps but it's didn't work during bullet 5 (while running "python setup.py install"). Steps taken from: Taken from https://servercheck.in/blog/running-ansible-within-windows
1) Download and install Cygwin, with at least the following packages selected (you can select the packages during the install process):
libyaml
libyaml-devel
curl
python (2.7.x)
python-crypto
python-openssl
python-paramiko
python-setuptools
git (2.1.x)
vim
openssh
openssl
openssl-devel
2) Download and install PyYAML and Jinja2, as they're not available via Cygwin's installer:
1. Open Cygwin
2. Download PyYAML:
curl -O https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz
3. Download Jinja2:
curl -O https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz
4. Untar both downloads:
tar -xvf PyYAML-3.10.tar.gz && tar -xvf Jinja2-2.6.tar.gz
5. Change directory into each of the expanded folders and run python "python setup.py install" to install each package.
6. Clone ansible from its repository on GitHub:
git clone https://github.com/ansible/ansible /opt/ansible
This was tested with Ansible version v1.6.6, change directory into /opt/ansible and checkout the correct tag: git checkout v1.6.6.
7. Add the following lines into your Cygwin .bash_profile:
# Ansible settings
ANSIBLE=/opt/ansible
export PATH=$PATH:$ANSIBLE/bin
export PYTHONPATH=$ANSIBLE/lib
export ANSIBLE_LIBRARY=$ANSIBLE/library
8. At this point, you should be able to run ansible commands via Cygwin (once you restart, or enter source ~/.bash_profile to pick up the settings you just added).
Try ansible --version to display Ansible's version.
9. Passwordless ssh will need to be set up between your Windows machine and the deployment host(s)
To enable passwordless ssh on Centos - ssh-copy-id root#node
To enable passwordless ssh on SuSE I followed the steps in this blog:
http://www.firedaemon.com/blog/passwordless-root-ssh-public-key-authentication-on-centos-6
install sshpass v1.05 on your Windows machine<br>
The error that I got during during bullet 5 is:
$ python setup.py install
running install
running build
running build_py
creating build
creating build/lib.cygwin-2.2.1-x86_64-2.7
creating build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/composer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/constructor.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/cyaml.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/dumper.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/emitter.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/error.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/events.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/loader.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/nodes.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/parser.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/reader.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/representer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/resolver.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/scanner.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/serializer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/tokens.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
copying lib/yaml/__init__.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml
running build_ext
creating build/temp.cygwin-2.2.1-x86_64-2.7
checking if libyaml is compilable
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/cygdrive/c/cygwin/include/python2.7 -c build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.c -o build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.o
checking if libyaml is linkable
gcc build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.o -L/cygdrive/c/cygwin/lib/python2.7/config -L/usr/lib -lyaml -o build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.exe
skipping 'ext/_yaml.c' Cython extension (up-to-date)
building '_yaml' extension
creating build/temp.cygwin-2.2.1-x86_64-2.7/ext
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/cygdrive/c/cygwin/include/python2.7 -c ext/_yaml.c -o build/temp.cygwin-2.2.1-x86_64-2.7/ext/_yaml.o
ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
.
$ ansible --version
Traceback (most recent call last):
File "/opt/ansible/bin/ansible", line 40, in <module>
from ansible.utils.display import Display
File "/opt/ansible/lib/ansible/utils/display.py", line 35, in <module>
from ansible import constants as C
File "/opt/ansible/lib/ansible/constants.py", line 30, in <module>
from ansible.parsing.splitter import unquote
File "/opt/ansible/lib/ansible/parsing/__init__.py", line 32, in <module>
from ansible.parsing.vault import VaultLib
File "/opt/ansible/lib/ansible/parsing/vault/__init__.py", line 82, in <module>
from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
File "/cygdrive/c/cygwin/lib/python2.7/site-packages/cryptography/hazmat/primitives/hashes.py", line 15, in <module>
from cryptography.hazmat.backends.interfaces import HashBackend
File "/cygdrive/c/cygwin/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/cygdrive/c/cygwin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 84, in <module>
packaging = pkg_resources._vendor.packaging
AttributeError: 'module' object has no attribute '_vendor'
Much easier:
#!/bin/sh
type apt-cyg || exit
apt-cyg install git python-{jinja2,six,yaml}
git clone --depth 1 git://github.com/ansible/ansible
cd ansible
PATH+=:~+/bin
export PYTHONPATH=~+/lib
ansible --version
Result
ansible 2.0.0 (devel 2a50957ad8) last updated 2015/09/15 21:22:17 (GMT -500)
Assuming Cygwin is installed:
Open up a Cygwin Terminal
alias cyg-get="/path/to/cygwin/setup/package/setup-x86_64.exe -q -P"
cyg-get cygwin32-gcc-g++,gcc-core,gcc-g++,git,libffi-devel,nano,openssl,openssl-devel,python-crypto,python3,python3-devel,python3-openssl,python3-pip,python3-setuptools,python3-devel,tree,wget,zip,make
The lack of spaces and the presence of commas here is important!
Upgrade pip via pip3 install --upgrade pip
pip install ansible
Notes:
The cyg-get alias allows you to install all packages via the command line instead of searching in the Cygwin UI.
The ansible installation includes a step where "Running setup.py bdist_wheel for pynacl" is executed - this takes at least half an hour but does eventually complete.
Although Ansible may work in Cygwin, note that it is not officially supported and it doesn't sound like it will be in the near future.
Note running Ansible from a Windows control machine is NOT a goal of the project. Refrain from asking for this feature, as it limits what technologies, features, and code we can use in the main project in the future. A Linux control machine will be required to manage Windows hosts.
Cygwin is not supported, so please do not ask questions about Ansible running from Cygwin.
Taken from the Ansible Documentation
One alternative to consider is running a Linux virtual machine on your Windows host and use that as your Ansible controller.
1. download cygwin
2. on the "Select Packages" page, select "Category" from the View (on top left)
3. mark "Devel" to "Install" (you will change the "Default" to "Install"
4. mark "Python" to "Install"
5. from "Web" select "wget"
6. from "Net" select "Openssh"
7. progress to install the packages with "Next"
8. go to the destination folder where you installed cygwin
9. right click "Cygwin.bat" and run as Administrator
10. write "easy_install-2.7 pip"
11. write "pip2 install ansible"
You need also to rebase all the packages to solve the problem of forking, for this then write:
rebase-trigger full
close Cygwin shells (or even reboot your windows)
run Cygwin installer again and just click on "Next" until you reach the end of the installation, then Cygwin will rebase all the packages.
After that you can use ansible without any problem (I hope so you will have the same situation as me, as it's working for me)
It took me a lot of days searching and trying to solve installing ansible on
Windows 10 Home Edtion
With later installer https://cygwin.com/setup-x86_64.exe you can install ansible and ansible-doc directly. Just select it from the list and set to install.
Try this apt-get remove python-cryptography, also you may need to install paramiko-1.10.0.tar.gz manually.
➤ ansible --version
ansible 2.1.0
Steps for Ansible 2.7.6 and Python3 and Cygwin 2.11.2(0.329/5/3)
Having Cygwin installed
Install python3
c:\cygwin64-setup>setup-x86_64.exe -q -P python3
$ python3 --version
Install pip
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python3 get-pip.py
$ pip --version
Install dev tools (for Ansible)
c:\cygwin64-setup>setup-x86_64.exe -q -P make
c:\cygwin64-setup>setup-x86_64.exe -q -P gcc-g++
c:\cygwin64-setup>setup-x86_64.exe -q -P python3-devel
c:\cygwin64-setup>setup-x86_64.exe -q -P libffi-devel
c:\cygwin64-setup>setup-x86_64.exe -q -P openssl-devel
c:\cygwin64-setup>setup-x86_64.exe -q -P openssh
Install ansible
$ pip install ansible
$ ansible --version
Check which ssh is used (https://serverfault.com/a/913435)
% which ssh
/cygdrive/c/WINDOWS/System32/OpenSSH/ssh
Note: if not cygwin ssh is used (like above) change env PATH variable for cygwin or change Ansible inventory hosts file items with flag ansible_ssh_executable=/usr/bin/ssh
I had a problem with "resolve symbolic links" - so i coudn't install it from "pip install /path/absible.tar.gz"
But i unpacked it (under root = administrator) to folder and installed from folder, not archive.
And - oh, it works - ansible was installed to cygwin.
This worked for me:
~$ cat setup_ansible_cygwin.sh
#!/bin/sh
echo binutils,curl,gcc-g++,git,gmp,libffi-devel,libgmp-devel,\
make,nano,openssh,openssl-devel,python-crypto,python-paramiko, \
python2,python2-devel,python2-openssl,python2-pip,python2-setuptools |\
tr ',' ' ' |\
xargs apt-cyg install
apt-cyg remove python2
apt-cyg install python2
pip2 install --upgrade pip
pip2 install ansible
# inside: Installing collected packages: MarkupSafe, jinja2, PyYAML, ansible