error in installing matplotlib1.5.1 in python3.5 - python

I have 'Windows 8'. I installed 'python35-32' successfully. Then I download 'matplotlib 1.5.1' . But it can not installed . I get an error that required package can not be built.

Try this:
Open cmd with admin privilege. (right click and Run as administrator)
Enter this command pip install matplotlib, and wait for the installation to complete.
Alternative:
If you want to keep the wheels for offline installation later, you can do the following:
Open cmd, and enter this command
pip install --download /path/to/some/dir/ matplotlib. This will download matplotlib and all other required wheels in the directory /path/to/some/dir/.
To install, enter this command: pip install --no-index --find-links /path/to/some/dir/ matplotlib
Here /path/to/some/dir/ is the directory where the file gets downloaded. You can use . instead of /path/to/some/dir/ to download in the current directory.
Edit:
Take a look at matplotlib installation guide for windows. The line most relevant to your case is probably this:
For Python 3.5 the Visual C++ Redistributable for Visual Studio 2015 needs to be installed.
So just install it by following the link and then follow the above procedure. That should do the trick.
Note: They also suggest that the best option is using one of the pre-packaged python distributions that already provide matplotlib built-in, like Anaconda, miniconda and canopy. You may want take into consideration too.
Edits as per your comment
As I have already said, anaconda is a pre-packaged python distribution that includes hundreds of python packages. To quote the official python page, anaconda is "a full Python distribution for data management, analysis and visualization of large data sets". So you can do pretty much everything with anaconda that you can do with the traditional python (aka CPython), plus you have a great number of popular python packages at your disposal.
To get yourself started with anaconda, you can check this out: Test drive Anaconda.

Related

Why is Python 3.8.2 stored in nonstandard place?

My download install of Python 3.8.2-amd64 is stored in:
C:\Username\AppData\Local\PackageCache\{13ee6ab9-4dca-406c-bc3b-5d86391d39a1}
Why is it stored in PackageCache rather than \Python\Python38?
I can execute py at the command line, but neither pip command nor pip --version are recognized, so I can't install pandas, numpy, etc.
When I try to download get-pip.py I get error message no such site.
It depends if you have customized the installation when you installed Python on your computer. If you do, it will be installed in C:\Program Files but if you don't, it is installed in your Windows profile so you don't need to have administrative rights to install it.
You can find a little bit more on this subject on the Python documentation site

Matplotlib installation for python 3.6. and windows 8

I do not understand exactly what I should do to install Matplotlib. I read a lot of posts but I do not have so much of fluent knowledge in programming so basically all of this that i read is quite confusing. Does anyone know what exactly should be done when having Python 3.6., visual code studio and Windows 8 to install Matplotlib?
A way that is simple using the original python from python.org with PATH installed is to use pip. You can check by opening cmd and entering python. If it is not a recognised command then you will have to reinstall python but make sure to tick the box at the start to enable PATH. once this is done you can install packages such as numpy and matplotlib.
In cmd type pip install Then the package you want to install from the PyPI website and using the EXACT name in the url before the version number. It should be like: /PACKAGE/VERSION.
eg. for matplotlib the url is /matplotlib/VERSION, so the name would be matplotlib. To install the latest version pip install matplotlib
If for some reason you want to uninstall a package you would do: pip uninstall PACKAGE. To install a specific version use pip install PACKAGE==VERSION where VERSION is the exact version name in the url. For full documentation visit Packaging Help.
Visual code studio is not necessary in this situation. This question is too broad and asking for a recommendation on software. Because of this, I went with the original python installation way and not any 3rd party software.

Installing librdkafka on Windows to support Python development

A little background: I am working on some python modules that other developers on our team will use. A common theme of each module is that one or more messages will be published to Kafka. We intend at this time to use the Confluent Kafka client. We are pretty new to python development in our organization -- we have traditionally been a .NET shop.
The complication: while the code that we create will run on Linux (rhel 7), most of the developers will do their work on Windows.
So we need the librdkafka C library compiled on each developer machine (which has dependencies of its own, one of which is OpenSSL). Then a pip install of confluent-kafka should just work, which means a pip install of our package will work. Theoretically.
To start I did the install on my Linux laptop (Arch). I knew I already had OpenSSL and the other zip lib dependencies available, so this process was painless:
git clone librdkafka repo
configure, make and install per the README
pip install confluent-kafka
done
The install of librdkafka went into /usr/local:
/usr/local/lib/librdkafka.a
/usr/local/lib/librdkafka++.a
/usr/local/lib/librdkafka.so -> librdkafka.so.l
/usr/local/lib/librdkafka++.so -> librdkafka++.so.l
/usr/local/lib/librdkafka.so.l
/usr/local/lib/librdkafka++.so.l
/usr/local/lib/pkgconfig/rdkafka.pc
/usr/local/lib/pkgconfig/rdkafka++.pc
/usr/local/include/librdkafka/rdkafkacpp.h
/usr/local/include/librdkafka/rdkafka.h
Now the painful part, making it work on Windows:
install precompiled OpenSSL
git clone librdkafka repo
open in VS2015
install libz via NuGet
build solution
install to where???
This is where I'm stuck. What would a standard install on a Windows 7/8/10 machine look like?
I have the following from the build output, but no idea what should go where in order to make the pip install confluent-kafka "just work":
/librdkafka/win32/Release/librdkafka.dll
/librdkafka/win32/Release/librdkafka.exp
/librdkafka/win32/Release/librdkafka.lib
/librdkafka/win32/Release/librdkafkacpp.dll
/librdkafka/win32/Release/librdkafkacpp.exp
/librdkafka/win32/Release/librdkafkacpp.lib
/librdkafka/win32/Release/zlib.dll
<and the .h files back in the src>
Any recommendations on an install location?
I'm not sure where the ideal place to install on Windows would be, but I ran the following test with some success.
I copied my output and headers to C:\test\lib and C:\test\include, then ran a pip install with the following options:
pip install --global-option=build_ext --global-option="-LC:\test\lib" --global-option="-IC:\test\include" confluent-kafka
Unfortunately, this doesn't quite work because the confluent-kafka setup does not support Windows at this time: https://github.com/confluentinc/confluent-kafka-python/issues/52#issuecomment-252098462
It's an old question but seems still no easy answer yet. Also Confluent seems too busy to work on Windows supporting...
I had the same headache couple weeks ago and after some research, I managed to make it work for me on Windows. I logged my finding and uploaded a pre-compiled library to my Git, please check and see if it helps. :D
https://github.com/MichaelZhangCA/confluent-kafka-python
My environment is Python 3.6 64 bit version but ideally, it should also work for 32 bit if you follow the same approach.
I assume you have successfully followed instructions from MichaelZhangCA (https://github.com/MichaelZhangCA/confluent-kafka-python/) from previous post.
If you did so, these probably were the last two commands executed:
::Install confluent-kafka
cd C:\confluent-kafka-python\confluent-kafka-python-0.11.4
python setup.py install
If that is correct, those DLLs were created under C:\confluent-kafka-python\librdkafka-reference\release\.
All you have to do is to copy them to a diretory already in Widnows' PATH.
For example, I use Anaconda 5.2 For Windows, with python 3.6. My Anaconda Prompt has an empty directory in PATH, so I copied there those DLL's:
::Anaconda Prompt - copy DLLs to a directory already in PATH
mkdir %CONDA_PREFIX%\Library\usr\bin
copy C:\confluent-kafka-python\librdkafka-reference\release %CONDA_PREFIX%\Library\usr\bin
If you don't use Anaconda, just copy those DLL's to any other directory in Windows' PATH. You may also leave them in C:\confluent-kafka-python\librdkafka-reference\release, and add this directory to PATH.

using python libraries downloaded from external sources

I've downloaded python libraries (tar.gz) from external links. How to use these libraries, I mean in which directory under the python should I unzip such libraries.
How to use downloaded libraries with python when we are using:
windows 7
Ubuntu
Also how to install these libraries without using pip in Linux? Do we have to set path in windows7 to use the libraries?
Guys better to post comments then to give negative points. With your suggestion I can modify my post. I dont think you to be smart guy by rating negative points in any comments.
For Linux based systems (e.g., Ubuntu):
$ tar xzf package.tar.gz
$ cd package
$ python setup.py install
Also, look input pip https://pypi.python.org/pypi/pip
On Windows and Linux, all you need to do is unzip the archive somewhere, cd into and run the following command as administrator (usually by running cmd.exe as Administrator on Windows or by using sudo on Linux):
python setup.py install
If the package does not have a setup.py, it can get tricky. Most of the time the package just needs to be copied into your Python's site-packages folder.
You will find some packages that need to be built. On Linux, you can usually do this pretty easily. On Windows, you will need the appropriate compiler, usually a free version of Visual Studio will do, although you have to make sure you get the correct version of Visual Studio. I've heard reports that you can also use MingW.

Python - pip install pandas, not working

I am trying to install pandas via pip install pandas but when I do, I get the error:
Command python setup.py egg_info failed with error code 1 in
c:\users[username]\appdata\local\temp\pip_build_[username]\pandas
I followed the answer given here and installed ez_setup.py without incident, but still get the error when doing pip install pandas.
Thanks for any help, if I can provide more information please let me know.
The easiest way to install pandas and its dependencies on Windows is to download the relevant packages from Christoph Gohlke's Python Extension Packages for Windows repository. You'll find the files for pandas here as well as a list of other required dependencies.
On Linux (Debian / Ubuntu varieties), when NOT installing inside a virtual environment, but in the main system, I find it best to just use the Synaptic Package Manager (because even the --user switch seems to fail when trying to install pandas without sudo). Search for pandas inside Synaptic PM. There's varieties for python 2 and 3.
However, on linux, I have generally found the cleanest, easiest, and overall safest approach to be creating virtual environments and then use pip install <package name> inside the virtual environment. I believe this would be best on Windows too.
I installed Pandas package following procedure listed after the following disclaimer section:
Disclaimer:
- I don't consider myself a computer expert so follow the instructions at your own risk.
- My procedure worked on my windows computer
- My windows computer has python 2.7 installed from python.org
- My python GUI is IDLE
- I don't recall installing pip, it is possible that it installs at the time of installing python 2.7 from python.org (not sure)
- The directory in which my pip.exe is located is under C:\Python27\Scripts
Procedure:
Open a command window for the directory under which you have pip.exe, (in my case is Scripts). The prompt looks like this in my case: C:\Python27\Scripts>
At the prompt type pip install pandas. The prompt looks like this in my case: C:\Python27\Scripts>pip install pandas
Press ENTER key. You should see message: "Collecting pandas" being displayed in the command window.
Once the system completes collecting pandas, you should see message "Successfully installed pandas-0.22.0" , or similar depending on version collected.
Picture shows steps 1 -4 as shown in my computer command window.collecting_pandas

Categories

Resources