I am trying to install pyenchant on Mac OS X Yosemite. It works fine on linux machines but not in mac, I am having the following error:
ImportError: The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI.
This is how I installed the package:
pip install pyenchant
and next, I import it in this way:
import enchant
I am using Python 3.4.
Enchant is a C library, and pyenchant provides Python bindings to that library.
For your code to work, you need to install Enchant as well.
If you're using homebrew, you can use:
>>brew install enchant
After installing Enchant, you can then install Pyenchant:
>>pip install pyenchant
I hope this helps.
Also, make sure your Xcode is updated. If it is not updated, you will get an error when running the brew installer:
configure: error: cannot run C compiled programs.
Related
I'm trying to install geopandas on my M1 mac and I'm running into errors
I tried to pip install all the dependencies individually but where I'm tripping up is in the install of pyproj.
I installed PROJ using brew install proj and that worked fine
When I try to pip install pyproj, I get the follow error
Building wheels for collected packages: pyproj
Building wheel for pyproj (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyproj (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
PROJ_DIR is set, using existing PROJ installation..
running bdist_wheel
running build
running build_py
running build_ext
building 'pyproj._geod' extension
pyproj/_geod.c:704:10: fatal error: 'geodesic.h' file not found
#include "geodesic.h"
^~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' 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 pyproj
Failed to build pyproj
ERROR: Could not build wheels for pyproj, which is required to install pyproject.toml-based projects
Any help would be much appreciated
At the moment, installing geopandas on M1 macs can be achieved via conda or pip+homebrew.
GeoPandas itself is written in pure Python, so there is no issue running that on any architecture. However, it depends on other libraries that are written in other languages (C, C++) that need to be compiled specifically for M1 chips. While you could compile it yourself, I am not going to cover this option as it is not user friendly.
There are three possible sources of required libraries - pip wheels, conda-forge, and Homebrew.
When a Python package requires C dependency, it can create wheels with the dependency compiled for each system and chip architecture. See for example pygeos - https://pypi.org/project/pygeos/#files. What you need is *macosx_11_0_arm64.whl . If your package doesn't offer it, you have to find another way of installing than pip. Since GeoPandas requires shapely and fiona (among others) that do not have these wheels, you should look elsewhere - either on conda-forge or Homebrew. Below are both options tested as of today.
Conda and conda-forge way (recommended)
Conda-forge currently has all packages geopandas needs
Install M1 version of miniforge or mambaforge. It can be downloaded from here - https://github.com/conda-forge/miniforge.
conda install -c conda-forge geopandas pygeos
Note: if you install x86 (Intel) version of conda, it will run under Rosetta2 and install all packages using x86 architecture, meaning that everything will run under emulation. Try to avoid that.
Pip and Homebrew way
Homebrew can install C libraries compiled for M1. Python packages will find and use them.
Using an environment with Python 3.9
Install shapely:
brew install geos
export DYLD_LIBRARY_PATH=/opt/homebrew/opt/geos/lib/
pip install shapely
DYLD_LIBRARY_PATH is needed for shapely to find GEOS installation.
Install fiona:
brew install gdal
pip install fiona
Install pyproj:
brew install proj
pip install pyproj
Install geopandas and pygeos for speedups:
pip install pygeos
pip install geopandas
Note that this is a copy&paste of my own explanation given in https://github.com/geopandas/geopandas/issues/1816#issuecomment-1003093329.
Related https://github.com/pyproj4/pyproj/issues/1027
I was stuck with the same problem, I also tried setting the environment values for PROJ_DIR, PROJ_LIBDIR, PROJ_INCDIR but perhaps setting the values is causing the error, so closed the terminal and tried again and was able to install correctly
when I'm typing the command
brew install pygobject3 --with-python#2 gtk+3
I'm always getting the error message
invalid option --with-python#2
I'm getting the same error message when I want to run the gtk+3 under mac os 10.15
Namespace Gtk not available
Maybe the Version of 10.15 of MacOS the problem....
gtk+3 version 3.24.12 and pygobject3 Version 3.34.0 are installed.
Installation of homebrew for MacOS
gtk+3 version 3.24.12 and pygobject3 Version 3.34.0 are installed.
Python3.7 is installed
File "...anaconda3/envs/python37/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available
I would like to run the program DemonEditor on MacOS 10.15 (Catalina)
to make some settings of my engima2 satellite receiver, for this I need the requirements "GTK+ >= 3.16 with PyGObject bindings".
Maybe some of the experts can help me.
Thanks very much
Since I am the author of this program, I am forced to report that since the program is designed for Linux, it will not work on MacOS without minor changes to the program itself. But still it’s possible.
DemonEditor
Тo resolve dependencies, it is enough to install as follows:
brew install gtk+3 pygobject3 adwaita-icon-theme
pip3 install requests
Upd.
I created an experimental brunch and added small changes to the program for the possibility of testing the launch in the MacOS. Perhaps not all the functionality will work (I have not tested it), but the program should start.
Gud luck!
STRIKE. It works, I can start the DemonEditor-GUI under 10.15. I have remove all packages via the
brew remove --force $(brew list)
installed the three packages again, via
brew install python3 gtk+3 pygobject3 adwaita-icon-theme
BUT. The most important step was to add the "Installation folder" of the brew packages to my python path but execute the comand
export PYTHONPATH=/usr/local/lib/python3.7/site-packages.
My assumption is, that due to fact, that I have installed an own conda-environment for python37, the site-packages have to be added to the path.
Big thanks for the help.
On my test system, I did not set any paths or environment variables! Just installed python 3 with the command:
brew install python3
Then I installed the dependencies as described above.Then I downloaded the archive from here, and in the unpacked folder of the program I simply gave the command:
./start.py
Below is the output of the commands python3 --version and brew list
Compare with your list, perhaps this will somehow help identify the missing components.
python3 --version
Python 3.7.4
brew list
adwaita-icon-theme libepoxy
atk libffi
cairo libpng
fontconfig librsvg
freetype libtiff
fribidi lzo
gdbm openssl#1.1
gdk-pixbuf pango
gettext pcre
glib pixman
gobject-introspection pkg-config
graphite2 py2cairo
gsettings-desktop-schemas py3cairo
gtk+3 pygobject3
harfbuzz python
hicolor-icon-theme python#2
icu4c readline
jpeg sqlite
libcroco xz
Upd. For the experiment, I removed all my packages with the command:
brew remove --force $(brew list)
Then again installed by commands as described above
brew install python3 gtk+3 pygobject3 adwaita-icon-theme
Working!
I'm running OSX 10.11 and have python 2.7.10 installed on my computer. I want to install pygame1.9.2 for the said environment (don't want to install it for python3 which is installed on my computer as well).
When I try to install this one - http://www.pygame.org/ftp/pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip - it says, "This package is incompatible with this version of OS X and may fail to install." Even if I continue, installation fails somehow.
I tried "pip install pygame" then it says
"Collecting pygame Could not find a version that satisfies the
requirement pygame (from versions: ) No matching distribution found
for pygame. "
How do I install it?
(for future reference) After spending many hours I found the following command to be working!
sudo pip install --user git+https://github.com/pygame/pygame/
It's not 1.9.2 but can run what I wanted with python 2.7.10
>>> pygame.__version__
'2.0.0.dev0'
I've installed the quasiben 64 bit osx Pygame version using conda. I'm running Python 2.7.1 and I've made sure the library was installed by doing :
$ conda search pygame
and getting the following :
pygame * 1.9.1 py27_1 quasiben
Anyway when I try to import the library in one of my .py program, I get the following failures :
ImportError: dlopen(/Users/usrname/anaconda/lib/python2.7/site-packages/pygame/base.so, 2): Library not loaded: /usr/local/lib/libSDL-1.2.0.dylib
Referenced from: /Users/usrname/anaconda/lib/python2.7/sitepackages/pygame/base.so
Reason: image not found
My system is El Capitan.
Try just uninstalling pygame and reinstalling it: https://www.youtube.com/watch?v=c_TzqzKZpMw
And make sure your pygame version is up to date along with your python.
It looks like you are missing one of the dependencies. Try to install all dependencies using brew:
brew install sdl sdl_ttf sdl_image sdl_mixer portmidi
This article has nice instruction on how to install PyGame from scratch on OS X.
I'm trying to install wxPython 2.8 unicode version, to be able to use robotframework-ride.
So far the installer downloaded from the site failed with an error saying "There was no software to install"
And using Brew installs the 3.0 version, that is not compatible with ride.
I would appreciate some help on this issue, I'm a new Mac user (just got given one at the office, and have to use it for my project) , and this is the only thing so far that I haven't been able to solve at all.
The version I need to install is: wxPython2.8-osx-unicode-2.8.12.1-universal-py2.7
The installer doesn't seem to work at all with this version of OSX.
Thank you in advace.
Actually wxPython 3.0 can work with RIDE. here are my pip list:
decorator (4.0.6)
docutils (0.12)
ecdsa (0.13)
Flask (0.10.1)
gunicorn (19.0.0)
itsdangerous (0.24)
Jinja2 (2.7.3)
MarkupSafe (0.23)
paramiko (1.16.0)
pip (7.1.2)
pycrypto (2.6.1)
robotframework (3.0)
robotframework-databaselibrary (0.6)
robotframework-rammbock (0.4.0.1)
robotframework-requests (0.4.0)
robotframework-ride (1.5.1)
robotframework-selenium2library (1.7.4)
robotframework-sshlibrary (2.1.2)
selenium (2.48.0)
setuptools (18.7.1)
vboxapi (1.0)
Werkzeug (0.9.6)
wheel (0.26.0)
wxPython (3.0.2.0)
wxPython-common (3.0.2.0)
Pip cannot find wxPython to install. use homebrew instead:
$homebrew install wxPython (will install 3.0.2.0)
$pip install robotframework (will install 3.0)
$pip install robotframework-ride (will install 1.5.1)
Allow 3.0 check to '~/homebrew/lib/python2.7/site-packages/robotide/__init__.py':
if sys.platform == 'darwin':
supported_versions.append("2.9")
supported_versions.append("3.0")
Remove ~/.robotframework before start ride.py to void RIDE crashing when loading last-opened folder. Make a short shell script ~/homebrew/bin/ride:
#!/bin/sh
rm -rf ~/.robotframework
~/homebrew/bin/ride.py
and chmod +x ~/homebrew/bin/ride.
From shell enter 'ride', all should work well -- just reopen your test suite each time.
I ran into the same error:
$ sudo installer -pkg /Volumes/wxPython2.9-osx-2.9.5.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg/ -target /
installer: Package name is wxPython2.9-osx-cocoa-py2.7
installer: Installing at base path /
2015-10-19 11:27:48.417 installer[875:22541] Package /Volumes/wxPython2.9-osx-2.9.5.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg uses a deprecated pre-10.2 format (or uses a newer format but is invalid).
installer: The install failed (The Installer could not install the software because there was no software found to install.)
As you may know, on OS X, RIDE supports both wxPython 2.8 and 2.9, and that's why I'm using v2.9 here:
try:
import wxversion
from wxversion import VersionError
if sys.platform == 'darwin': # CAN NOT IMPORT IS_MAC AS THERE IS A wx IMPORT
wxversion.select(['2.8', '2.9'])
else:
wxversion.select('2.8')
except ImportError:
print "wxPython not found."
Although wxmac formula can be used to install wxPython 2.9.5.0, but on OS X 10.11 El Capitan, you'll encounter the following error reported in #16329 while building wxWidgets.
So, we have to build it from (modified) source code:
Install Xcode, and download wxPython-src-2.9.5.0.tar.bz2.
Extract the tarball and replace #include <WebKit/WebKit.h> (in src/osx/webview_webkit.mm) with #include <WebKit/WebKitLegacy.h>.
Then follow the instructions described in wxmac formula to build and install wxPython:
$ cd wxPython-src-2.9.5.0
$ PREFIX=/usr/local
$ ./configure --prefix=$PREFIX --enable-shared --enable-monolithic --enable-unicode --enable-std_string --enable-display --with-opengl --with-osx_cocoa --with-libjpeg --with-libtiff --with-libpng --with-zlib --enable-dnd --enable-clipboard --enable-webkit --enable-svg --with-expat --with-macosx-version-min=10.11 --enable-universal_binary=i386,x86_64 --disable-precomp-headers
$ sudo make install
$ cd wxPython
$ sudo python setup.py build_ext WXPORT=osx_cocoa WX_CONFIG=$PREFIX/bin/wx-config UNICODE=1 INSTALL_MULTIVERSION=1 BUILD_GLCANVAS=1 BUILD_GIZMOS=1 BUILD_STC=1
$ sudo python setup.py install WXPORT=osx_cocoa WX_CONFIG=$PREFIX/bin/wx-config UNICODE=1 INSTALL_MULTIVERSION=1 BUILD_GLCANVAS=1 BUILD_GIZMOS=1 BUILD_STC=1
To verify the installation:
$ python
>>> import wx
>>>
Note that this is a 64-bit setup, you don't have to run RIDE in 32-bit mode.