Error while install lxml - python

I'm trying to install lxml with pip. I received this initial error when running my script:
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library?
A quick search of the above error (such as here) revealed I need to install lxml.
While trying to install lxml I receive the following error:
clang: error: unknown argument: '-mno-fused-madd'
error: command 'cc' failed with exit status 1
Any idea what is going on?

According to Xcode 5 Release Notes:
The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
...
To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning. For example, you can install a Python native extension with:
$ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future \
easy_install ExtensionName
Set following environment variable before installing lxml:
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

Related

How to fix errors occurring on installation of Jupyter Notebook

I am new to Python and try to install Jupyter Notebook from within a Windows command prompt window using:
pip install jupyter
But after a couple of minutes of downloading, an error message is displayed as shown below:
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe
' 'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\
_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\asd\Ap
pData\Local\Temp\tmpnj_hhq6y'
cwd: C:\Users\asd\AppData\Local\Temp\pip-install-_pnki5r8\pywinpty
Complete output (6 lines):
Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/
Checking for Rust toolchain....
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\asd\appdata\local\progr
ams\python\python38-32\python.exe' 'c:\users\asd\appdata\local\programs\python\p
ython38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata
_for_build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpnj_hhq6y' Check the logs for
full command output.
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.
I have attached here just the last part of the error output.
How to fix this error for a successful installation of Jupyter Notebook?
EDIT1: I installed the Rust package from the link in the error message. After that I tried installing Jupyter Notebook once again, and this time after proceeding a few steps further than before, it output another error:
Building wheels for collected packages: pywinpty
Building wheel for pywinpty (PEP 517) ... - WARNING: Subprocess output does
not appear to be encoded as cp1252
WARNING: Subprocess output does not appear to be encoded as cp1252
error
ERROR: Command errored out with exit status 1:
command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe'
'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\_v
endor\pep517\_in_process.py' build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpaj5
u66_y'
cwd: C:\Users\asd\AppData\Local\Temp\pip-install-mep4ye8d\pywinpty
Complete output (60 lines):
Running `maturin pep517 build-wheel -i c:\users\asd\appdata\local\programs\pyt
hon\python38-32\python.exe`
Compiling proc-macro2 v1.0.26
Compiling unicode-xid v0.2.2
Compiling syn v1.0.71
Compiling winapi v0.3.9
Compiling jobserver v0.1.22
error: could not compile `proc-macro2`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
dY'¥ maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit code: 101": `cargo rustc --messag
e-format json --manifest-path Cargo.toml --release --lib --`
dY\x8d1 Building a mixed python/rust project
dY"- Found pyo3 bindings
dY\x90\x8d Found CPython 3.8 at c:\users\asd\appdata\local\programs\python\pyt
hon38-32\python.exe
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option
error: aborting due to previous error
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option
error: aborting due to previous error
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option
error: aborting due to previous error
Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'c:\\users\\asd\\app
data\\local\\programs\\python\\python38-32\\python.exe'] returned non-zero exit
status 1
----------------------------------------
ERROR: Failed building wheel for pywinpty
Failed to build pywinpty
ERROR: Could not build wheels for pywinpty which use PEP 517 and cannot be insta
lled directly
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.
Upgrade your pip first:
pip install --upgrade pip
Then:
pip install jupyter
I'reached this post after failing to install notebook on a 32-bit python 3.8.3 execution. And as far as I found, pywinpty, which is a dependence, does not support 32-bit executions (see sources below).
I solved the problem by installing python on its 64-bit version.
Sources:
How do I determine if my python shell is executing in 32bit or 64bit?
pip install fails on Python 3.8 32-bit, prevents Jupyter install #129 which simply says that wheels cannot be installed with 32 bit Python and that you should use 64 bit Python instead.
We can't generate 32 bit wheels, sorry. Please use a 64bit build of Python.. Was not my case but might be useful this similar issue when using python 3.8 64-bit
Error installing Jupyter & pywinpty (Python)
https://github.com/spyder-ide/pywinpty/issues/123
Do
pip install wheel
and try again. It worked for me.
What to do:
Check if your python is 64-bit version. If no, go to python site (for example, here is the link to download 3.7.9. Just click at the version that has label "for AMD64/EM64T/x64", do it with any version you wish, just I don't like to use the newest version). Remove yours (with the uninstall file) and download this. Don't forget to put the checkmark near "Add PATH" below;
Download Rust (the description is inside) - you need some files. Check the PATHs - if you want to change them, do it (the names of the variables and where they are - both are written, you can search in the Internet how to change PATH var's (for example));
Go to Windows Shell with admin mode (Win+X and you get the field) - here is the most comfortable place to work;
Go to your python.exe (for example, my way is C:\Users\user\AppData\Local\Programs\Python\Python37) - just for sure;
python.exe python -m pip install --upgrade pip;
python.exe pip install jupyter;
If an error was returned that contains the missing of wheel, try to download it: python.exe pip install wheel.
Donwload any library you miss during installation and continue since the step you stopped at.
Try using Anaconda. link to install conda https://www.anaconda.com/products/individual
then cmd : conda install numpy
cmd: conda install jupyter
cmd : jupyter notebook
The error message looks quite clear, you needs to install Cargo via https://rustup.rs/
I have faced the same issue when I'm using vscode. The simplest solution is to use conda instead of pip
conda install jupyterlab

Pip install fuzzy fails because gcc fails to compile

I want to install fuzzy python package. I have windows 7 operating system with mingw32 and python 2.7. When I try to pip install the fuzzy package, I get the following error.
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: build\temp.win-amd64-2.7\Release\src\fuzzy.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Here's the complete log.
Please please help!
I had the same error when trying to install the (not part of anaconda) mmh3 module on an anaconda installation on windows.
It seems that your path includes an independent mingw installation (c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe)
I had to remove my mingw from my path so that it used the MiniGW that corresponds to your Python, so try to check e.g. if
ld.exe -version
and
...\anaconda\MinGW\bin\ld.exe -version
give you the same, if not, make sure your path is correct as discussed above...

error installing fiona in OSX 10.9

I am having difficulty with installing fiona.
I have followed fiona's official documentation ( https://github.com/sgillies/fiona) as well as the related thread below.
trouble installing Fiona in python cpl_error.h: No such file or directory
I had no trouble with pip install shapely and I used brew install gdal. When I use the command pip install fiona I get a number of errors
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
as well as warnings with regards to gdal-config such as "Failed to get options via gdal-config"
I am worried there is an issue with gdal-config's location thats causing the issue. I think I might have had GDAL previously installed with kyngchaos for QGIS use a while ago before I used the brew install
Any insights would be much appreciated. I can't imagine I am the only one who has had issues installing fiona, but I haven't been able to find a resolution through google searching alone yet.
If you're using XCode 5.1, the problem is likely unrecognised options in Clang. See here for details on how to fix this: http://bruteforce.gr/bypassing-clang-error-unknown-argument.html

PIL Install issues - seems like I may be missing some required libs, but which ones and how to install?

I had an error uploading images on my Python/Django site, and so installed the PIL library (1.1.6 on python 2.4 with CentOS) and also installed the jpeg library using $ sudo yum install freetype freetype-devel jpeg jpeg-devel libpng libpng-devel and the pil library using wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
After unpacking, and running: python setup.py build_ext -i and sudo python setup.py install
I get an long string of errors, but they end in (previous ones are all about error: expected attribute etc...) :
_imaging.c:3041: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âfunctionsâ
_imaging.c:3138: warning: return type defaults to âintâ
_imaging.c: In function âDL_EXPORTâ:
_imaging.c:3138: error: expected declaration specifiers before âinit_imagingâ
_imaging.c:3149: error: expected â{â at end of input
error: command 'gcc' failed with exit status 1
Please let me know if more of the errors messages are required to properly troubleshoot.

What is the best way to setup Django on os X 10.7 Lion?

I am setting up Python and Django on os X 10.7 from a virgin install and Xcode 4.3.
I tried using the default install of Python:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
I normally use a Python based package manager called easy_install.
Easy_install seems to not be able to find the compiler.
EDIT: When I tried to install MySQL-python I got this error:
$ sudo easy_install MySQL-python
Password:
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P9H9WX/MySQL-python-1.2.3/egg-dist-tmp-rRTfZL
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
Apparently, the system attempts to use the same compiler used to compile the installed Python framework.
For some reason Apple didn't include llvm-gcc-4.2.
Xcode 4.1 used GCC, but with Xcode 4.3 that seems to have changed.
From what I can gather, Apple wants to use Clang as the compiler vs GCC.
So I added to .bash_profile:
cc=clang
I decided I would just recompile Python with clang but first, I needed to install readline.
Fail:
Wed Feb 22 16:04:59 ~/Downloads/readline-6.2
$ ./configure
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
Beginning configuration for readline-6.2 for i386-apple-darwin11.3.0
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/Bryan/Downloads/readline-6.2':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
What the easiest way to install Django on Lion 10.7?
Did you install the command-line tools with Xcode 4.3? They are not installed by default. You can install them by going to the Downloads pane in Xcode 4.3's preferences.
Making it way too hard:
First, make sure you install Xcode (available for free in the Mac App Store). It includes all the build tools that might be necessary to compile certain Python packages.
To get easy_install just download setuptools and follow the instructions for installing on Mac OS X at that link.
Once that's done, you can easy_install virtualenv to get a nice segregated environment to work in.
For the MySQL issue you have to edit the site.cfgfile:
mysql_config = /usr/local/mysql/bin/mysql_config
And then:
$ python setup.py build
$ sudo python setup.py install
Try updating XCode and reinstall all global site-packages. You may also want to try pip instead of easy_install.
You can also try to compile with
export ARCHFLAGS='-arch i386 -arch x86_64'
This solved many of my problems in the past when upgrading OSX versions.

Categories