How to install lxml on Windows 8 64-bit with Python 3.4 - windows-8

Related Question 1
Related Question 2
[Error Log]
C:\Users\Hima\Documents\Installers\python\packages>python -m pip install lxml-3.4.4-cp34-none-win_amd64.whl
lxml-3.4.4-cp34-none-win_amd64.whl is not a supported wheel on this platform.
[Environment]
Windows x86 (64-bit)
Installed Visual Studio C++ 2014
Python 3.4
I use pip (or pip3.4.exe; built-in to Python 3.4) to pip install lxml
[Issues]
1. The lxml file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml shows as not supported.
2. In the following Package Index for lxml, there isn't a suitable lxml file for 64 bit and Python 3.4.
https://pypi.python.org/pypi/lxml/3.4.4

I have been struggling with this today. I found, elsewhere on stackoverflow.com, this two-part and quick solution, which resulted in python no longer complaining when I tried to use lxml:
Go to this repository and download a version which matches your Python installation (the version number, and 32- vs 64-bit. I use Python 3.5.1 64-bit, installed on Windows 10, so on that page, I chose lxml-3.6.0-cp35-cp35m-win_amd64.whl.
You say you use Python 3.4, so use a version that matches that (or maybe the one you already have).
There is some helpful information at the top of the page about which version of CPython the files are built against.
The output of python -v will also tell you which version of MSVC++ was used to build your version of the python executable.
This answer is useful for determining MSVC versions from the output of python -v (which contains a build number instead of a version number).
My download directory is d:\Downloads. Python must be in your PATH environment variable for the next step to work. Use a command like the following, changing "D:\Downloads" to the pathname to your download directory. Then, at a DOS prompt, type:
python -m pip install "D:\Downloads\lxml-3.6.0-cp35-cp35m-win_amd64.whl" lxml-3.6.0-cp35-cp35m-win_amd64.whl

My config:
Python 3.5
Windows 10
Downloaded lxml-3.6.0-cp35-cp35m-win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
Copy this file to: c:\Program Files\Python35\
first in cmd line:
c:\Program Files\Python35>py -m pip install --upgrade pip
Then in cmd line:
c:\Program Files\Python35>py -m pip install lxml-3.6.0-cp35-cp35m-win_amd64.whl
And it's done

Related

Unable to install XGBOOST on MAC using Anaconda

I am using the Graphical Interface of Anaconda. I tried to install py-xgboost but it gave me the following error-
*UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
py-xgboost -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.*
It says I have python 3.8 installed in my system but when I checked the python version on my system using the command python2 --version & python3 --version it says I have python 2.7.16 & python 3.7.3
I dont have python 3.8
What shall I do now? The above python version were there already. I never installed and someone told me not to remove those versions as some of the MAC applications are dependent on them. Its a MAC BOOK PRO 15 ( 2019 )
After some research I found a solution. I had to downgrade my python version.
But as explained above when I tried to check the version of python I am using I was getting 2.7 & 3.7.3 but my ANACONDA gives an error that I have version 3.8
That was because Anaconda uses the python which is installed in a separate directory, it was not using the python installed at the PATH directory. So I had to downgrade python which the ANACONDA was using by using the command -
conda search python
BTW if your terminal says conda command not found, then you need to edit your PATH first.
Then it gives a list of python version, you can then see which version is right for your XGboost version and then use the command-
conda install python=3.7.7
or whatever version you wanted to use.
After the downgrade of python, anaconda will ask you to downgrade other libraries as well, so go ahead and do that too unless you are using some command which was not there in the older version.
Now install py-xgboost from ANACONDA Graphical interface or by using conda method
conda install -c anaconda py-xgboost

How to utilise pymssql after Upgrading from Python 3.4 to 3.7? Unable to remove error

My Python application uses the pymssql module to connect and edit SQL data in forms. I upgraded to Python 3.7 and I receive the following error:
"DLL load failed: %1 is not a valid Win32 appication."
I have the 64bit win32 version of Python 3.7. I can't seem to resolve this. Does pymssql work with Python 3.7?
I uninstalled and reinstalled both Python and pymssql to ensure I have latest version.
The fix was to completely unisntall Python 3.7 and pip, then delete the Python folder, and reinstall. I used the advanced install settings which puts Python in C:\Program Files. The only difference now is I need admin permissions to pip install/update etc but that's ok.

Error installing library of Scrapy in PyCharm

I can install other packages, but can't install Scrapy. I get the following errors:
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'lxml.etree' extension
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
However, C++ is installed, which I installed numerous of times. I have x86 and 64 bit installations (not sure if it's 10.0) but I have 2013-2017 versions installed.
Please upgrade your pip by following command.
python -m pip install --upgrade pip
Then install Scrapy by following command.
pip install Scrapy
download latest twisted package and install with pip.
https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
after that install scrapy
In my case, I found that pywin32 was not installed...
So I did
download the latest Twisted package from https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
You want to use the amd64 if you have Windows 64 (regardless if it's an Intel processor or not)
You can use any browser for the download and copy/paste the file into the project folder of your current pycharm project.
Then in pycharm type this:
pip install Twisted-20.3.0-cp39-cp39-win_amd64.whl
(assuming that your package was Twisted-20.3.0-cp39-cp39-win_amd64.whl)
then proceed with:
pip install Scrapy

cuda install error on Ubuntu 17.04

abigail#abilina:~/Downloads$ sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
Selecting previously unselected package cuda-repo-ubuntu1604.
(Reading database ... 205999 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (8.0.61-1) ...
Setting up cuda-repo-ubuntu1604 (8.0.61-1) ...
Warning: The postinst maintainerscript of the package cuda-repo-ubuntu1604
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package cuda-repo-ubuntu1604)
OK
abigail#abilina:~/Downloads$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
cuda : Depends: cuda-8-0 (>= 8.0.61) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
My ubuntu version is 17.04. Does this mean my Linux currently can't install CUDA? I want to install TensorFlow with GPU support.
Per suggestion:
abigail#abilina:~/Downloads$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
https://launchpad.net/ubuntu/zesty/amd64/nvidia-cuda-toolkit
above is the correct one.
apt-get install nvidia-cuda-toolkit
but remember the cuda installed through apt were installed in different location. manually create ln -s at /usr/local/cuda for include,lib64,and bin
I have successfully installed CUDA 8.0 + the latest patch from NVIDIA on Ubuntu 17.04:
Download the .run file from https://developer.nvidia.com/cuda-downloads, choosing Ubuntu 16.04 (Base Installer)
You will not be able to install it by just running, because it is looking for a file called InstallUtils.pm which is not present in Ubuntu 17.04, but curiously, is present in the .run file - so: unpack the .run file using ./cuda*.run --tar mxvf
copy InstallUtils.pm (should be in the /bin path) to /usr/lib/x86_64-linux-gnu/perl-base
Run the installer (You may want to say no to the driver install step to keep the one you install through apt - I'm using 381.22, because 375.26, which is provided by the .run file does not support my 1080ti)
gcc 6 is incompatible with CUDA, but this is easily remedied for compiling the sample files: just add export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98" to your bashrc file, and comment out
from one of the headers (I think it was host_config.h, but you'll see it once you try to compile) - comment out these lines:
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 3)
#error -- unsupported GNU version! gcc versions later than 5.3 are not supported!
This is all from memory, so hopefully it's accurate enough.
I managed to find this solution thanks to these useful posts:
https://devtalk.nvidia.com/default/topic/983777/can-t-locate-installutils-pm-in-inc/
https://devtalk.nvidia.com/default/topic/949770/cuda-8-0rc-supporting-gcc6-/
For ubuntu 17.04, I had to use cuda 9.0 (deb version)
https://developer.nvidia.com/cuda-release-candidate-download
I couldn't get it to work otherwise. Cuda 8.0 needs gcc 5.3.1 but cuda 9.0 is compatible with gcc 6.3.0 which is installed on ubuntu 17.04 automatically.
More precisely, this is what I did:
On Ubuntu 17.04, install CUDA 9.0 — you can currently download the beta version 
https://developer.nvidia.com/cuda-release-candidate-download
I downloaded the .deb file and haven’t had any problems — follow the steps they recommend when you download cuda 9.0 
sudo dpkg -i cuda-repo-ubuntu1704-9-0-local-rc_9.0.103-1_amd64.deb
sudo apt-key add /var/cuda-repo-9.0-local-rc/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Then follow the post installation steps from the nvidia instructions (i.e., setting PATH and LD_LIBRARY_PATH) 
 http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions)
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Cuda 9 is compatible with gcc 6.3.0 (which comes with 17.04). I used arch=sm_52 and sometimes for my make files have to go ‘make clean’.
Installing Cuda 9.0 was the simplest solution in my case.
Alternatively, if you'd prefer cuda 8, you can download the deb file and then use the command
dpkg-deb -x cuda_8.*.deb /usr/local/cuda-8.0
to extract the contents from the deb file and have them placed in the desired directory.
Source: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#advanced-setup)

Missing gcc-4.0 error on pip install twisted in virtual env

I'm trying to use Scrapy inside a virtualenv, which requires installation of twisted as well. I did pip install Scrapy with no problems, but when I try pip install twisted, I'm getting the following error multiple times in the output:
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
I previously had a similar problem when trying to install python packages on my actual system, which is why I started using virtualenv in the first place. Is this an issue of the python version installed on my environment? This is what I currently have:
Django - 1.5 - active
Python - 2.7.3 - active development (/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload)
Scrapy - 0.16.4 - active
pip - 1.2.1 - active
setuptools - 0.6c11 - active
wsgiref - 0.1.2 - active development (/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7)
yolk - 0.4.3 - active
To check which version of gcc I have I typed gcc at the command line and got
i686-apple-darwin11-llvm-gcc-4.2: no input files
I tried export CC=gcc-4.2 before running pip install twisted, and I got:
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/s8/d0f65gc93nbchdk52g2cg5f80000gn/T//ccWQa7cJ.out
error: command 'gcc-4.2' failed with exit status 255
It sort of looks to me like it's looking for powerpc-apple-darwin11-llvm-gcc-4.2, and what I have above is i686-apple-darwin11-llvm-gcc-4.2--are these different and therefore causing the problem?
To give more background info, I installed Python 2.7 from a Python.org installer a long time ago before upgrading from Snow Leopard straight to Mountain Lion. If I simply type in python at the command line I get
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:32:06)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
So I'm guessing that means I'm using Apple's Python? And it's built with gcc-4.0.1? So if that's the case, shouldn't I not need to do the export CC=gcc-4.2? Or do I need to do that AND switch to the Python.org version of Python? (And if the latter, how do I do that?)
Update: I tried this solution for switching Python versions but it didn't work.
Update: I managed to switch Python versions (outside of my virtualenv) using the sudo port select --set python python27 command, but this didn't solve the problem even though I'm now showing:
Python 2.7.3 (default, Nov 17 2012, 19:54:34)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
when I type python at the commmand line.
Update: I also found this solution to a question that seemed to have almost the exact same issues as I'm having, but I'm already upgraded to XCode 4.6 and definitely have the Command Line Tools installed as described in the aforementioned solution (Preferences>Downloads tab>Install Command Line Tools). I do also have XCode 3.2.6 installed, however--any chance that's causing my problems?
Have you tried CC="$(type -p clang)" pip install twisted? You don't necessarily need to use gcc to compile Twisted's extensions; selecting clang instead might clear up whatever weird problem seems to be infesting your gcc installation.
If that doesn't work, I would suggest un-installing any Python.org versions of Python and then possibly re-installing both the OS and Xcode, since it looks like something might have corrupted your system Python install. I have no idea how references to powerpc stuff have persisted into Mountain Lion, since Lion removed support for ppc.