Homebrew python3 installation error - macos

I was trying to install python 3 using Homebrew by doing brew install python3 and there was the warning.
Warning: The post-install step did not complete successfully
You can try again using brew postinstall python3
So I did instead do brew postinstall python3
```==> /usr/local/Cellar/python3/3.4.1/bin/python3 -m ensurepip --upgrade
dyld: Library not loaded: ##HOMEBREW_CELLAR##/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/Python
Referenced from: /usr/local/Cellar/python3/3.4.1/bin/python3
Reason: image not found
xcrun: error: active developer path ("/Users/dorislee/Desktop/Macintosh HD/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select to change
xcrun: error: active developer path ("/Users/dorislee/Desktop/Macintosh HD/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select to change
READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting```
I am not really sure what to do, is there a way to undo this and fix it?

You can try and uninstall brew remove python3 and then do brew cleanup and brew prune and then reinstall python3 brew install python3 with whatever flags you want.

Check your PYTHONPATH variable, clean it, and then try to install python3 anagin

Related

Pipx failed to build packages

When I run the command pipx install eth-brownie I receive the following error message,
fatal error from pip prevented installation. Full pip output in file:
/Users/gentgjonbalaj/.local/pipx/logs/cmd_2021-10-22_11.10.14_pip_errors.log
pip failed to build package:
cytoolz
Some possibly relevant errors from pip install:
cytoolz/functoolz.c:23087:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
cytoolz/functoolz.c:23092:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
cytoolz/functoolz.c:23176:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
error: command '/usr/bin/clang' failed with exit code 1
Error installing eth-brownie.
I tried to use the command "pip install eth-brownie" but my terminal says "pip command not found."
I received the same error, and was finally able to resolve after running the following commands:
Using Homebrew:
brew install recordclass
brew install cython
xcrun codesign --sign - "/Users/jon/Library/Python/3.8/lib/python/site-packages/regex/_regex.cpython-38-darwin.so"
pip3 install cytoolz
pip3 install pybind11
M1 Mac Chips has issues. There are issues at 2 fronts. (a) cytoolz, (b) regex==2021.10.8.
(a) cytoolz is resolved by doing pip install cytoolz and not pipx
(b) regex issue is a big one. The issue is with the version. Packaging bug causes an x86_64 regex to be installed on an Apple Silicon (M1) device (https://githubmemory.com/#dragos-vlad). To fix this: Pinning regex to 2021.9.30 should work for the time being. However for that you will have to change the requirements in the brownie git that you will use for installing.
For anyone using Windows 10 I had the same issue, just had to run:
pip install Cython
then
pip install eth-brownie
For whatever reason I was finally able to install with pip but not with pipx.
I have this problem with python 3.10. Try pyenv and use python 3.9.1 and it works.
What worked for me in Python 3.10 was installing cython and cytoolz before brownie.
Enter these three commands:
python3 -m pip install --user cython
python3 -m pip install --user cytoolz
python3 -m pip install --user eth-brownie
I had the same problem, Use pip rather than pipx.
command: pip install eth-brownie
For anyone using Python 3.10 on windows, simple run
pip install eth-brownie
It worked for me when I used pip3 install eth-brownie instead of pipx

Error installing mysql-python: library not found for -lssl

I'm having trouble installing mysql-python. Created a new virtualenv and when installing mysql-python... here's the error message:
(env)$ pip install mysql-python
Collecting mysql-python
...
clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk build/temp.macosx-10.12-x86_64-2.7/_mysql.o -L/usr /local/Cellar/mysql/5.7.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.12-x86_64-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Using homebrew, I have installed:
libressl
openssl
openssl#1.1
mysql
Already tried to brew link but brew refuses to do so.
The OS is MacOS Sierra.
Can anyone help? Thanks!
You can set ssl library path explicitly.
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
I tried updating Xcode's CLT, uninstalling mysql, checking mysql_config, etc., but had no luck.
I found that running brew info openssl shows:
...
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
...
Running those two commands, followed by pip install, worked for me (in my case when installing mysqlclient).
Solved it with these steps:
brew uninstall mysql
brew install mysql-connector-c
pip install mysql-python
brew unlink mysql-connector-c
brew install mysql
Found the answer here https://stackoverflow.com/a/25920020/576192
Not sure if this is the right way, but this is how I managed to solve it.
I'm able to fix the error by running:
pip install -r requirements.txt --global-option=build_ext --global-option="-I/usr/local/opt/openssl/include" --global-option="-L/usr/local/opt/openssl/lib"
I was finally able to fix it by
xcode-select --install
I was sure I had already done that... but obviously I hadn't. Definitely worth a shot!
For me on mac, running this command solved the issue
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
Actually we need to set ssl library path to get this issue fixed.
Worked for me by doing this
$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
Which is a slightly altered version of the recipe above (note: pip install at the end!)
If you want to install mysql-python, I suggest you to install mysqlclient instead. The authors of these two modules are the same. By far, the authors all turn to keep maintaining mysqlclient. mysqlclient supports both Python 2 and Python 3. And you can use the same codes like mysql-python. Blew is my installation solution for you.
$ brew info openssl
$ brew unlink mysql-connector-c
$ brew install mysql
$ brew link --overwrite mysql-connector-c
$ pip install mysqlclient
If there is an error before pip install mysqlclient. Please fix it according to methane's answer.
And run pip install mysqlclient again.
Or download and install .dmg from the MySQL dev site: https://dev.mysql.com/downloads/file/?id=467834
For those of you who are installing MySQL v5.7 with Brew
Uninstall mysql-connector-c
$ brew uninstall mysql-connector-c
Install specific version, very likely you need to uninstall other installed versions
$ brew install mysql#5.7
You will need to add it to the PATH, since this is 'keg-only' formulae, this is printed after it is installed
$ echo 'export PATH="/usr/local/opt/mysql#5.7/bin:$PATH"' >> ~/.zshrc
Replace ~/.zshrc with the appropriate file.
Install mysql-connector-c
$ brew install mysql-connector-c
Check it is installed properly
$ which mysql
# /usr/local/opt/mysql#5.7/bin/mysql
$ mysql_config
# Usage: /usr/local/opt/mysql#5.7/bin/mysql_config [OPTIONS]
Compiler: Clang 10.0.0.10001145
Options:
--cflags [-I/usr/local/opt/mysql#5.7/include/mysql ]
--cxxflags [-I/usr/local/opt/mysql#5.7/include/mysql ]
--include [-I/usr/local/opt/mysql#5.7/include/mysql]
--libs [-L/usr/local/opt/mysql#5.7/lib -lmysqlclient -lssl -lcrypto]
--libs_r [-L/usr/local/opt/mysql#5.7/lib -lmysqlclient -lssl -lcrypto]
--plugindir [/usr/local/opt/mysql#5.7/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.7.24]
--libmysqld-libs [-L/usr/local/opt/mysql#5.7/lib -lmysqld -lssl -lcrypto]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/opt/mysql#5.7/include/mysql]
pkglibdir [/usr/local/opt/mysql#5.7/lib]
plugindir [/usr/local/opt/mysql#5.7/lib/plugin]
Now install mysqlclient
$ pip install mysqlclient

Install OpenCV on Mac - VirtualEnv (Updated bash_profile and pip error)

I'm trying to install OpenCV on my Mac (OS X 10.11.3) using this tutorial because it uses a VirtualEnv, which is a way to ensure consistency in development.
I skipped Steps 1&2 since I already have Xcode and Homebrew. Step 3 worked well (after updating ~/.bash_profile as instructed):
User:~ user$ brew update
Already up-to-date.
User:~ user$ source ~/.bash_profile
User:~ user$ which python
/usr/local/bin/python
User:~ user$
The trouble is in Step 4:
User:~ user$ pip install virtualenv virtualenvwrapper
-bash: /usr/local/bin/pip: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
User:~ user$
This is probably because I'm in the local bin due to adding this to ~/.bash_profile from Step 3:
# Homebrew
export PATH=/usr/local/bin:$PATH
This basically means I can't access pip from that location, but when I try to install it locally (with the above lines added in ~/.bash_profile), it says:
User:~ user$ brew install pip
Error: No available formula with the name "pip"
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
https://pip.readthedocs.org/en/stable/installing/#install-pip
User:~ user$
How can I access pip with my updated ~/.bash_profile from Step 3? Thanks!
Ok, I figured out the problem.
I was getting the same errors as this stackoverflow question, so I ran the recommended
brew link python
which encountered the same errors as this stackoverflow question, so I ran the recommended
brew link --overwrite python
which seemed to correct the problem and allows me to run pip while accessing Homebrew packages first.

Library not loaded error after brew install php56

I'm upgrading from php5.5 to php5.6 on OSX Mavericks using homebrew. I run
brew install php56
Everything runs and completes fine but when I run php -v the following error comes up
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.53.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Trace/BPT trap: 5
How do I fix this?
Try this
brew uninstall --ignore-dependencies node icu4c
brew install node
For me simply upgrading php helped.
brew upgrade php
The corresponding file dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.<version>.dylib did not exist but a more recent one. So my php version was a bit behind compared to other dependents which probably upgraded icu4c when upgrading them. (Either node or postgresql?)
In my case, it was a symlink issue with the previous installation. Everything was fine after running
brew link --overwrite php56
P.S. Before running with --overwrite, try without. If you get the error below like I did, then go ahead.
Linking /usr/local/Cellar/php56/5.6.3...
Error: Could not symlink bin/pear
Target /usr/local/bin/pear
is a symlink belonging to php55. You can unlink it:
brew unlink php55
To force the link and overwrite all conflicting files:
brew link --overwrite php56
To list all files that would be deleted:
brew link --overwrite --dry-run php56
previous solution was not working:
$ php -i
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.55.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Trace/BPT trap: 5
solved with:
$ brew update && brew upgrade icu4c
see https://github.com/Homebrew/homebrew-php/issues/1701
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.53.dylib
It sounds like an issue with icu4c. So try:
brew uninstall icu4c && brew install icu4c
brew unlink icu4c && brew link icu4c --force
In case of further issues, investigate them by brew doctor.
For this to be fixed for me (Mavericks 10.9.5) necessitated the entire routine described in this GitHub issue, namely:
brew uninstall --force php56
brew update
brew tap --repair
find $(brew --cache) -mindepth 1 -print -delete
brew install -v php56
(and in my case I needed brew install php56-mcrypt as well, as that was missing.)
I'd had PHP 5.4 and 5.6 installed before, with 5.4 being the active ("linked") one – I wanted to switch. I'd installed the php-switcher package, which is a very neat way of letting you do this, but it wasn't working prior to the above procedure.
brew uninstall --ignore-dependencies node icu4c
brew install node
worked for me.

Can't install imagemagick with brew on Mac OS X mavericks

I am using Homebrew v0.9.5 on my Mac OS X version 10.9.4
When I run the command: `brew install imagemagick, this error occurred.
$ brew install imagemagick
==> Installing dependencies for imagemagick: libpng, freetype
==> Installing imagemagick dependency: libpng
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.6.12.mavericks.bottle.tar.gz
curl: (7) Failed connect to downloads.sf.net:443; Operation timed out
Error: Failed to download resource "libpng"
Download failed: https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.6.12.mavericks.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://downloads.sf.net/project/libpng/libpng16/1.6.12/libpng-1.6.12.tar.gz
curl: (7) Failed connect to downloads.sf.net:443; Operation timed out
Error: Failed to download resource "libpng"
Download failed: https://downloads.sf.net/project/libpng/libpng16/1.6.12/libpng-1.6.12.tar.gz
I have added --disable-openmp option, it also doesn't go well.
$ brew install imagemagick --disable-openmp
brew doctor command result has no problem.
$ brew doctor
Your system is ready to brew.
Have you tried a
$ brew update
$ brew install imagemagick --disable-openmp --build-from-source
Apparently that seemed to fix it for me on Mac OS 10.8 (Mountain Lion). Previously I checked out the latest imagemagick brew recipe with "brew versions imagemagick" and "git checkout e68e443", see here and here
I'm not certain whether the source of my problem was the same as the OP's, however (though this has an accepted answer already) I'll post this in case this solution works for others.
Using brew install imagemagick, I would encounter the following error:
curl: (52) Empty reply from server Error: Failed to download resource
"libpng" Download failed:
https://downloads.sf.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.xz
Which is similar, if less specific than the OP's message.
As it turned out, I already had a previous version of libpng installed (version 1.5.7). I then ran:
brew upgrade libpng
Followed by another brew install libpng, and this time it succeeded, as it now had the correct version needed.
This problem also occurs because https://downloads.sf.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.xz has a badly configured SSL certificate. Open the link in your browser and see if your browser complains.
If that's the case, you can manually download the file to /Library/Caches/Homebrew and run again.
Source: https://github.com/Homebrew/homebrew/issues/36703
For me it was upgrading to El Capitan. I found the simplest solution was to force remove homebrew:
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
then to re-install it:
sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then install imageMajick:
brew install ImageMagick
Depending on your setup you may not want to sudo. For me, its fine. Enjoy a snack while you manipulate images.
In my case the url was simply not correct, with which homebrew wanted to download the required file. I looked it up here http://sourceforge.net/projects/libpng/files/libpng16/older-releases/1.6.16/ by myself and copied it to /Library/Caches/Homebrew like #Dan suggested.
I then run brew install libpng again and it worked.
Follow this:
brew install imagemagick#6
Add below lines in to ~/.bash_profile file
export LDFLAGS="-L/usr/local/opt/imagemagick#6/lib" export
CPPFLAGS="-I/usr/local/opt/imagemagick#6/include" export
PKG_CONFIG_PATH="/usr/local/opt/imagemagick#6/lib/pkgconfig"
Install Rmagick
source ~/.bash_profile
gem install rmagick
If you are an Anaconda/Miniconda user on Mac OSX or Linux, you can install packages like imagemagick using conda.
conda install -c conda-forge imagemagick
https://anaconda.org/conda-forge/imagemagick

Resources