error: command '/usr/bin/clang' failed with exit code 1 - python

I download a not commonly-used software package in github in Mac M1. I am trying to compile and install myself according to the instruction.
I have encountered the following problem saying "command/usr/bin/clang with exits error 1". I did install xcode in my mac. Because the built-in gcc version is 4.2, I upgrade the version using brew install gcc#7 command and the link to this gcc version. But I still face the same compiling problem.
Does anyone have instructions for me how to solve this? The author did not maintain the source code anymore and I have struggled for one day and still can not fix the problem.

The follow steps worked!
upgrade pip and related components by:
python -m pip install --upgrade pip
pip install –upgrade wheel
pip install –upgrade setuptools
install openssl
brew install openssl re2
reinstall your package with some environment to be set
LDFLAGS="-L$(/opt/homebrew/bin/brew --prefix openssl)/lib -L$(/opt/homebrew/bin/brew --prefix re2)/lib" CPPFLAGS="-I$(/opt/homebrew/bin/brew --prefix openssl)/include -I$(/opt/homebrew/bin/brew --prefix re2)/include" GRPC_BUILD_WITH_BORING_SSL_ASM="" GRPC_PYTHON_BUILD_SYSTEM_RE2=true GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true pip install <your package name>
Source: https://candid.technology/error-command-usr-bin-clang-failed-with-exit-code-1/

Related

Error installing glpk package "Could not build wheels for glpk which use PEP 517 and cannot be installed directly" on Macbook

I'm practicing for a linear programming/optimization course I'll be taking in the fall.
Most of the course uses jupyter and part of the course requires me to install a package called 'glpk.' I'd like to install it on my mac since anaconda normally makes things like this a breeze, but so far everything I've tried has not worked.
I've tried:
sudo apt install libglpk-dev python3.8-dev libgmp3-dev
sudo pip3 install glpk --no-binary :all:
pip install --upgrade pip setuptools wheel
pip install glpk --no-cache-dir
pip --verbose install glpk
All of these have run into their own troubleshooting problems or have had no effect.
I'll happily listen to any advice or suggestions anyone has to offer, Thank you.
This answer assumes you have homebrew installed.
brew install glpk
# set C linker and include flags so that the pip wheel build can
# find the headers and library
LDFLAGS="-L$(brew --prefix glpk)/lib" CFLAGS="-I$(brew --prefix glpk)/include" pip install glpk
This should allow the glpk module to build.

Is it possible that Mac M1 users are not able to use Python wrapper for TA-Lib?

so I've been trying different methods to install TA-Lib, and found several different methods to install it, none of which have been easy, but even when TA-Lib is installed and appears on pip list, and even managed to install it on pipenv virtual environment, however if I actually want to go ahead and use it by typing
import talib
I get the following error:
ImportError: 2): Symbol not found: _TA_ACOS Referenced from: /Users/teo/.local/share/virtualenvs/trendingcoin-nriNAUCq/lib/python3.8/site-packages/talib/_ta_lib.cpython-38-darwin.so Expected in: flat namespace in /Users/teo/.local/share/virtualenvs/trendingcoin-nriNAUCq/lib/python3.8/site-packages/talib/_ta_lib.cpython-38-darwin.so
Now I would like you to know that I have tried many different methods to install it, they are detailed in this thread: Is it enough to install TA-Lib on Brew to use it? Pip throws me an error
As a wanna-be technical analyst, it would be sad if I can't use the infamous TA-Lib.
I was able to make it work following some of the steps in this github issue: https://github.com/mrjbq7/ta-lib/issues/381
$ arch -x86_64 brew install python#3.9
$ arch -x86_64 brew install ta-lib
$ arch -x86_64 brew link ta-lib
$ arch -x86_64 python3.9 -m pip install --no-cache-dir ta-lib
You'll need x86/brew and rosetta: https://stackoverflow.com/a/64997047/3090309
NOTE: In my case, I went though so many intents, that really made the difference to include the --no-cache-dir option.
The solution here seems to work:
https://github.com/mrjbq7/ta-lib/issues/408#issuecomment-839583759
$ conda install -c conda-forge ta-lib
Install ta-lib
brew install ta-lib
Find pip command for your environment
which -a pip
/home/<user>/.conda/envs/newenv/bin/pip <---------------
/usr/bin/pip
Install ta-lib wrapper via pip command
/home/<user>/.conda/envs/newenv/bin/pip install ta-lib
Here's what I did with my Mac M1:
# install python3.10
arch -arm64 brew install ta-lib
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include"
export TA_LIBRARY_PATH="$(brew --prefix ta-lib)/lib"
arch -arm64 python -m pip install --no-cache-dir ta-lib

probelm at installing channels(django), and importing it's inner packages(channels.layout)

I have the same problem.
pyhton(3.9.1).
using virtual environmnet (venv).
installed django.
updated:
setuptools: pip install --upgrade setuptools,
pip(20.3.3): py -m pip install --upgrade pip
wheel: python -m pip install --upgrade pip setuptools wheel
(latesed version for today(30/12/20)).
Tried to use: python -m pip install -U channels.
installed "Microsoft Visual C++ Build Tools"
Tried the self installing twisted: https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
All done, but still not working.
Also tried pip install:
pip install pytype
pip install django-channels.
The django-channels, but when runnig on PyCharm, it recognize channels but not: channels.layers.
Can anyone help?
I managed to install it:
just removed python, and installed instead Anaconda 3.

How to install dlib for python on mac?

I'm getting an error when trying to install dlib on Python 3.7 on macOS with
pip3 install dlib
I have installed CMake, so that is not the problem.
I'm getting these error messages:
Failed building wheel for dlib
and
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/j2/nvk5521j2vn9s1w95_0vlwkm0000gn/T/pip-install-ls2e_3mr/dlib/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/var/folders/j2/nvk5521j2vn9s1w95_0vlwkm0000gn/T/pip-record-hy3hu262/install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in /private/var/folders/j2/nvk5521j2vn9s1w95_0vlwkm0000gn/T/pip-install-ls2e_3mr/dlib/
at the end in red. The reason I need dlib is to install face_recognition.
I think there's more to the error message and it's probably related to CMake, either it's not installed properly or it's not compatible with the pip3 install dlib.
I suggest using Homebrew to install Python3 (which includes pip3) and CMake. Homebrew manages the installation of packages, tools, libraries that might depend on system-related tools, paths, etc. It also prevents you from having to use sudo to install stuff on your system.
Install Homebrew
See the "Install Homebrew" section of https://brew.sh/
Basically:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install Python3 (and pip3) using Homebrew
See https://docs.brew.sh/Homebrew-and-Python
See Homebrew's formula for the latest Python3 (python3.7, python3.8, python3.9)
Basically do one of the following:
$ brew install python#3.7 # or python#3.8 or python#3.9
$ brew install python#3 # get whichever is the latest version
Check Python installation
$ python3 -V
$ python3 -m pip -V
Install CMake using Homebrew
See https://formulae.brew.sh/formula/cmake
Basically:
$ brew install cmake
Check CMake installation
$ brew info cmake
$ cmake --version
Finally, install dlib with pip
$ python3 -m pip install dlib
If you don't want to use Homebrew (for some reason), you can try installing CMake for Mac directly using the installers (dmg or tar.gz) from here: https://cmake.org/download/.
Install Homebrew from here
A bunch of dependencies are needed for dlib:
brew install cmake
brew install boost
brew install boost-python
brew install dlib
pip3 install numpy
pip3 install scipy
pip3 install scikit-image
pip3 install dlib
If this does not work, try:
python3 -m pip install dlib
dlib is dependent on cmake so you need to install that first.
You just need to run following commands on your terminal:
$ brew install cmake
$ pip install cmake
$ brew install dlib
$ pip install dlib
You can install the conda-forge Dlib package by running
conda install -c conda-forge dlib
Conda-forge has made sure to resolve all the dependency conflicts, so I had no issues with the installation. They have pre-built binaries for Windows, Linux, and Mac OS, and Python 2.7 through 3.8. The current package (at the time of this writing) is based on Dlib v19.19.
$ pip3 install --upgrade pip
$ pip3 install global
$ pip3 install cmake
$ pip3 install dlib
$ brew install dlib
$ sudo pip install dlib
The only thing you need to do, I guess, is run pip3 install dlib with sudo.
sudo pip3 install dlib

Can't install pycurl with pip

Can't install pycurl with pip, win xp x32, python 2.7.
here is the log
pip install pycurl
Downloading/unpacking pycurl
Downloading pycurl-7.19.3.1.tar.gz (116Kb): 116Kb downloaded
Running setup.py egg_info for package pycurl
Please specify --curl-dir=/path/to/built/libcurl
Complete output from command python setup.py egg_info:
Please specify --curl-dir=/path/to/built/libcurl
----------------------------------------
Command python setup.py egg_info failed with error code 10 in C:\Documents and S
ettings\User\build\pycurl
Storing complete log in C:\Documents and Settings\User\Application Data\pip\pi
p.log
Following the steps one mentioned above, solved my problem.
sudo apt install libcurl4-gnutls-dev librtmp-dev
pip install pycurl
This is a problem indeed. No need to update pip or easy install as it's often advised, well it won't hurt to update but you will still have the problem until you :
install libcurl4-gnutls-dev librtmp-dev packages
pip install pycurl
Worked the same in Linux
I had the same problem. I was able to install it with easy_install instead:
easy_install pycurl
For easy_install, see setuptools.
Here are easy steps I did to get around this:
Download the wheel of the version you want here: https://www.lfd.uci.edu/~gohlke/pythonlibs/
then you can pip install that like so:
pip install C:\sample\sample_dir\whl_file_downloaded
You should know be able to import in your python files
install pycurl using conda, conda will install all dependencies, Hope it works
conda install -c anaconda pycurl
steps to follow :
brew install openssl
PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" pip install --no-cache-dir pycurl
For Linux Please install the libcurl-devel package and then try. It will work.
So has said by Hai Vu you need to install cURL first.
Here is the dowload page : http://curl.haxx.se/download.html
I suggest you install it in your C:/ directory, or if you already installed it elsewhere copye the curl.exe file to your c:/
When done, you can try it by going to the cmd prompt :
cd c:/
curl "your-curl-request"
If it works then curl is correctly installed and you can install pycurl with pip.

Categories