I have installed plotly on the Raspberry Pi. The objective is connecting to a remote MySql database and plot interactive time-series plots (that would update as the new data arrives into the MySql database). But I am running into no module found even after installing it. Looks like the pip install plotly is installing the package for python 2.7 (below screenshot) but I am using 3.3 (latest). How do I install the package for latest Python version.
Screenshot shows, installation of the module and then importing this module into the Python script:
There are multiple python versions on your machine, and the pip command seems to be pointing to python version 2.7. You can point pip to your desired python installation with the following command:
python3 -m pip install plotly
This will use the pip that is associated with python3.
Not directly to your question. But since you are dealing with time-series data, you may consider Time Series DB instead of MySQL, and visualize the data with Grafana.
Related
I wanted to install matplotlib on azure Virtual machine. And I don't have access to internet due to security reason.
I have followed as per below steps:
Downloaded matplotlib package from python index web portal
Executed pip install matplotlib-2.1.0.tar.gz from conda prompt, it gave me Failed building wheel for matplotlib error
So I am trying to build Matplotlib on Windows Wheels via matplotlib-winbuild: https://github.com/jbmohler/matplotlib-winbuild
I have downloaded and extracted matplotlib-master, matplotlib-winbuild-master from github and executed python matplotlib-winbuild\buildall.py which needs Microsoft vs 2010 C++ but I have already installed Microsoft vs 2014 C++ as I am using python 3.6
I have searched and tried as per answers give in the below question, but they didn't help.
Offline Installation of python & pip
Getting error while using pip installation
I don't want to use conda to installed matplotlib due to proxy issues
What should I DO?
Instead of downloading the .tar.gz (which contains the source code) you can download the .whl (which contains the compiled code) see pypi page for matplotlib for example.
Now you need to grab the correct build, you can easily see looking at the name, copying on the machine and installing like:
pip install whatever_lib.whl
How do I download and install matplotlib for Python 3.5 for my mac to use in Eclipse? My mac is running macOS High Sierra version 10.13.1. I can handle quantum mechanics and thermodynamics, but the whole downloading and installing and using new python programs/packages/libraries/stuff is so hopelessly confusing to me. Assume I don't know anything, because I don't.
For scientific work using Python I recommend using Anaconda. It has all relevant packages installed.
Follow these steps:
Download Anaconda
Double Click the File in your Download Folder
For further setup with Eclipse, follow these steps.
Given that you have Python3 already installed you could also try:
python3 -m pip install matplotlib
In my experience, it is wise to consider installing a package manager like Anaconda. For something like matplotlib however, using
pip install matplotlib should be more than sufficient. For your information, the Mac already has pip (a package management system) installed, so running the above command should be enough.
I'm somewhat new to python and figured playing around with mySQL databases would be a good idea.
Now the error I am having is simply installing the mySQL connector. I have tried on both my Windows PC, and now here on my mac.
Each time I download the connector and install it, all goes ahead and installs, yet when I import mysql.connector I receive a traceback, ImportError saying that mysql is not a package.
I've been searching the internet trying to find information or ways to help this, but non have been successful.
It should be noted that I have restarted my computer, still with no success.
I installed python 3.5 via the official python website, and the mysql connector via the official mysql website.
You need to provide more information. Could tell us how you installed the connector? easy_install? pip? Are you on Python2 or Python3. On windows are you using the official Python installer or did you install Python via Cygwin?
Typically, after you install a Python package, you'll find it in the following location on Mac/Linux:
/usr/lib/python<version>/site-packages/
On Windows you'll find site-packages under the Python directory in C:\Program Files.
Which MySQL connector have you installed (there are several)?
Also, ensure you've installed the connector for the correct Python version. If you're using Python2, but are using pip3 to install the package, then pip will install it to the python3 site-packages and you won't be able to access it from Python2.
I'm not overly familiar with Linux and am trying to run a Python script that is dependent upon Python 3.4 as well as pymssql. Both Python 2.7 and 3.4 are installed (usr/local/lib/[PYTHON_VERSION_HERE]). pymssql is also installed, except it's installed in the Python 2.7 directory, not the 3.4 directory. When I run my Python script (python3 myscript.py), I get the following error:
File "myscript.py", line 2, in
import pymssql
ImportError: No module named 'pymssql'
My belief is that I need to install pymssql to the Python 3.4 folder, but that's my uneducated opinion. So my question is this:
How can I get my script to run using Python 3.4 as well as use the pymssql package (sorry, probably wrong term there)?
I've tried many different approaches, broken my Ubuntu install (and subsequently reimaged), and at this point don't know what to do. I am a relative novice, so some of the replies I've seen on the web say to use ENV and separate the versions are really far beyond the scope of my understanding. If I have to go that route, then I will, but if there is another (i.e. easier) way to go here, I'd really appreciate it, as this was supposed to just be a tiny thing I need to take care of but it's tied up 12 hours of my life thus far! Thank you in advance.
It is better if when you run python3.4 you can have modules for that version.
Another way to get the desire modules running is install pip for python 3.4
sudo apt-get install python3-pip
Then install the module you want
python3.4 -m pip install pymssql
The easiest way is to use virtual environments instead of system paths or environment scripts. See official Python package installation guide.
All you need to do is to
# Create fresh Python environemnt
virtualenv -p python3.4 my-venv
# Activate it in current shell
source my-venv/bin/activate
# Install packages
pip install mysqlclent
Note that mysqlclient is Python 3.x compatible version.
Okay so I tried to install matplotlib and python earlier from the command line. Turns out i probably already had python installed but it was not make(ing) plots. Then that didn't work so i tried to, from the software center install matplotlib. So my software center says it is installed. However, when i am in python it still can not find matplotlib. Also when i am not in python and try to run commands like
python setup.py clean
It says python cannot find setup.py
This has been going on for hours and i am a beginner linux user and it is horrible
From the command line you can install matplotlib as follows:
$ sudo apt-get install python-matplotlib
Once it's installed you can access it from inside python like this:
>>> import matplotlib
>>> help(matplotlib)
If you want more control over the version of python you're using, I recommend using Anaconda. Very easy to install and use.
If you want even more control you can build from source. That post is specifically about setting up IPython but the python build step are the same.