Installing VTK 5 for mayavi with Homebrew - python

I am trying to install Mayavi fro Python on Mac OS X Mavericks using Homebrew and pip. I am stuck because of an unclear error related to VTK: I have installed VTK 5 with Homebrew using
brew reinstall --python --qt vtk5
and tried to install Mayavi with
pip install mayavi
but I just get en error output which ends with
ImportError: No module named vtkCommonCorePython
I thought about an issue with my PYTHONPATH variable, but I cannot find where vtkCommonCorePython is located. My PYTHONPATH is
/Users/ft14968/Scripts:/usr/local/lib/python2.7/site-packages:usr/local/opt/vtk5/lib/python2.7/site-packages
Is there a way to circumvent this issue, or to install a working python VTK binding with Homebrew?

brew reinstall --python --qt vtk5
Check brew info for exactly what formula options are available. For vtk5, the options you're looking for are --with-python --with-qt. Anything unrecognized is ignored.

Related

How do I install python third party libs on the m1 chip?

The Mac Book Air M1 chip doesn't seem to support pep517 according to the errors of installing third-party libraries with pip or brew. Even using these methods without pep517 downloading the library locally didn't work. How does one circumvent this?
Error from using pip install pandas:
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
I've tried this:
pip install <lib>
installing the library locally and trying to install with pip without pep517
brew install <lib>
openblas installation of lib
python env on the intel venv
I had the exact same problem, with a different library but with the same error code for PEP 517, I was using python 3.9 at the time, I checked the docs and found out that it's a problem with the python version for the library, downgraded to Python 3.6 and voila! it worked.
Basically try downgrading to Python 3.6 and check.
Installing python libraries through Anaconda seems to work. I simply downloaded the installer and could later use the libraries globally. If someone has a better in-depth explanation, feel free to comment.
I was having the same message when trying to install a different package. I solved by removing the CommandLineTools and installing it again. The steps were:
sudo rm -r /Library/Developer/CommandLineTools
wait for command prompt...
xcode-select --install
This solved the issue for me.

Unable to install basemap package in python 3.6

I'm a newbie and so have problems installing the basemap package. I have Python 3.6.0(32 bit, windows)
I want to install basemap package.(Numpy and Matplotlib have already been installed). Versions available on internet are 3.3 compatible. Things I've tried:
Installing it with pip. Didn't work.
Found another package http://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap compatible. When tried to install, it gave egg info code 1 error.
Created virtual env and tried installing it. Gives error
Where am I going wrong?
the egg error is because GEOS is missing
try direct to install a wheel package:
get it from:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
then install with (case python 3.7 win64):
py -m pip install "C:\maxbook\maxboxpython\basemap-1.2.0-cp37-cp37m-win_amd64.whl"

Can't Install wxPython with Brew

I've tried to install wxPython on my mac with brew, using the command suggested at How do I install wxPython on Mac OS X? by rajmohanloganathan
brew install --python wxmac --devel
That seems to work, but when I try setting up the symlink, I don't find a folder corresponding to /usr/local/Cellar/wxmac/2.9.4.0/lib/python2.7/site-packages/wx. In my /usr/local/Cellar/wxmac/3.02/lib/, there is no python2.7 directory. The closest I come is /usr/local/Cellar/wxmac/3.02/lib/wx, and linking to that doesn't work.
When I brew doctor, I get a warning that python is installed in /Library and that this may cause problems with other installations. Is that the root of my problem? How do I go about fixing matters?
The advice I looked at is outdated.
brew install wxpython
is all you need.

pip install matplotlib fails on mavericks with homebrew

I am trying to install the Scipy python stack, but having issues.
I have a new mac os with mavericks (10.9).
I have installed homebrew and am using brew to manage installations.
I used
% brew install python
then (I verified pip is from my homebrew installation)
% pip install numpy [this works]
% pip install scipy [this works]
% pip install matplotlib OR pip install http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz
Both fail with the same error. After checking the backend, I get
Fatal Python error: PyThreadState_Get: no current thread
The error message from mac os X (the pop up error window) shows errors very similar to those in the previous thread
Homebrew + Python on mac os x 10.8: Fatal Python error: PyThreadState_Get: no current thread importing mapnik
It seems I need to fix the python bindings, as some of them linked against the /System/Library python that ships with the mac. What is not clear to me from the above post is
which of the Binary Images need to be "re-linked"? all of them? some seem quite general an not related to matplotlib
how do I actually use install_name_tool to fix the link? As I mentioned, some seem quite general - do I really want to change the path? Do I cp the dylib from old to new?
I have also tried
brew uninstall python
and re-brewing, all to get the same error. I am trying not to use EPD because EPD installs its own libxml2 and others, which I need for other software I will install, and this has caused me problems on an old machine. I am open to considering a virtualenv, but was hoping to learn to just fix my current problem if possible.
Thanks,
Andre
PS, when pip install matplotlib`, the following warning appears, which seems odd because matplotlib is such a staple piece of software
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
This is an issue in pygtk. You can test it with brew (it should throw the same error):
brew test pygtk
I ran into the same problem, and got past that error with the following steps from https://github.com/mxcl/homebrew/issues/13654
brew rm py2cairo
brew install py2cairo
You can test that pygtk is working using brew test pygtk again.
I'm still having other problems getting pip install matplotlib to work, so you may also run into more problems, but that should get you past that particular issue.
I had the same problem, and after some experimentation it seems that installing under Python 3 works more reliably. i.e. this installed without error:
pip3 install matplotlib
I then had to re-install everything else using pip3, and make sure I was running under python3 at execution time.
brew install freetype
it works on mac os sierra!

Import Error: No module named AppKit

I use Mac OS X Lion and Python 2.7. I am new to python. Can anyone tell me how to import AppKit and PyObjC to Python. But i get the errors when trying to import Import Error: No module named AppKit or 'Import Error: No module named PyObjC.
Trying easy_install does not help either.
What can i do to import these 2 modules?
If not already installed, install pip by running:
sudo easy_install pip
Then run:
## install for all users
sudo pip install pyobjc
or
## install for current user only
pip install pyobjc --user
NOTE: the general recommendation is to avoid using the system python, and use instead a user-maintained version, for example installed via brew install python3, macports, conda or whatever you already use for third party dependencies.
If you're on Mac it could be you're using the incorrect pip version, try sudo pip3 install -U pyobjc that solved it for me.
This a good guide on how to install PyObjc: http://ioanna.me/2009/09/installing-pyobjc-xcode-templates-in-snow-leopard/
When I was trying to install PyObjc I found it quite hard, but after a while, (and lots of google searches) I got it working.
Edit
I've found a more modern guide on how to do this. Download the templates and put them into your ~/Library/Developer/Xcode/Templates/ directory, and everything should work correctly.
If you are using PyCharm, you should install PyObjC package manually within it because of venv I guess. This was the only working solution for me.
In my case none of them worked. I was using Anaconda in my mac, later I discovered that the main issue with the Anaconda. Then I installed PyObjC with it's all supporting libraries inside Anaconda in a specific Environment.
I run the command line by clicking the Environment play icon and run my script.
It worked without any issues :)

Categories

Resources