Adding Python Modules on A2hosting Web Server - python

I am a newb so sorry in advance.
Background: I am currently using A2hosting as my web server. I have python on the web server (obviously), that I use to dynamically update my website by a cronjob. Now, I would like to make plots of stuff and add them to my website using the Python module matplotlib. I currently, do not have that module on the webserver, or at least I am getting the error that no module exists.
Question: So how do I add a Python module when I have SSH'd into my A2hosting webserver? I tried using sudo apt get but did not work.
My Error Message:
roy123#reichwein.net [~]# pip install numpy
Downloading/unpacking numpy
Downloading numpy-1.8.0.tar.gz (3.8Mb): 3.8Mb downloaded
Running setup.py egg_info for package numpy
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/home/roy123/build/numpy/setup.py", line 16
from __future__ import division, print_function
SyntaxError: future feature print_function is not defined
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/home/roy123/build/numpy/setup.py", line 16
from __future__ import division, print_function
SyntaxError: future feature print_function is not defined
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/roy123/build/numpy
Storing complete log in /home/roy123/.pip/pip.log
Thanks!

Related

How do I get the module installed with the python library working - Google client library for python - unable to find module

I'm on developers.google.com and trying out the Python Quickstart to create a simple Python command-line application that makes requests to the Drive API.
I have gone trough all steps however I get the following error
~/Pythondev/apidev$ python quickstart.py Traceback (most recent call last):
File "quickstart.py", line 4, in <module>
from googleapiclient.discovery import build
ImportError: No module named googleapiclient.discovery
I have tried this on Windows 10 as well as Linux , and I end up with the same error
What could be the cause ?
pip installed the library without any error messages.
import googleapiclient, httplib2, oauth2client
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'googleapiclient'
Running the quickstart.py file showed the above error.
Running import googleapiclient on the python console gives the same error
This is a link to the page on google developers :
https://developers.google.com/drive/api/v3/quickstart/
Thanks!

IB API not installing properly on Mac

So I'm trying to use the IB API wrapper from here and I try running the first line
from ib_insync import *
but am getting the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/ib_insync/__init__.py", line 10, in <module>
import ibapi
ModuleNotFoundError: No module named 'ibapi'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/ib_insync/__init__.py", line 13, in <module>
'IB API from http://interactivebrokers.github.io is required')
RuntimeError: IB API from http://interactivebrokers.github.io is required
but I've downloaded the IB API from the IB github (had to use The Unarchiver to unzip) and saved it on my desktop. As far as I can tell there's no pip3 command I can use to install it so I'm not sure what else I can do to install the IB API. I've allowed ticked all the boxes for the API in TWS. I'm not sure why it's not installing properly?
It seems to be the same issue found here but mine is for macosx. I've tried running the commands from README.md and they don't work. It just says no such directory exists.
Installing the a python module as a wheel is optional- its also possible to just include the path to the module in the PYTHONPATH environment variable. But if you're using the commands from the READ.ME to build and install a wheel, make sure you're in the pythonclient folder and then run:
python3 setup.py bdist_wheel
python3 -m pip install --user --upgrade dist/ibapi-9.75.1-py3-none-any.whl
Thats for the current API Latest version as of March 2019 which is 975.1

Trigger (Networktest) installation on Python 3.7

Currently I have the problem that I get the following error message under Python 3.7 when installing the package trigger (network test for router / switch).
If you try to install the offending package separately, then you get the same error message.
Collecting gtextfsm (from trigger)
Using cached https://files.pythonhosted.org/packages/98/12/edfdccf3d968ffbb94ac8e48b3172395b6902eb4265bded0b0d07a1652f3/gtextfsm-0.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\pip-install-4_suoa4z\gtextfsm\setup.py", line 19, in <module>
import textfsm
File "C:\Users\xxxxxx\AppData\Local\Temp\pip-install-4_suoa4z\gtextfsm\textfsm\__init__.py", line 2, in <module>
__version__ = textfsm.__version__
NameError: name 'textfsm' is not defined-
Is there another alternative to triggers?
Did someone have the problem described above?
Other solutions?

ImportError: No module named django_auth_ldap

I can't seem to get python ldap libraries to work properly with Django:
>>> from django_auth_ldap import *
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named django_auth_ldap
I'm running Ubuntu v14.
This is what a pip freeze looks like on my working environment:
Django==1.9.4
django-auth-ldap==1.2.7
django-filter==0.13.0
djangorestframework==3.3.3
Markdown==2.6.5
pyasn1==0.1.9
pyldap==2.4.25.1
python3-ldap==0.9.8.4
(I installed ldap for python3 as well to do a sanity check)
But as I go through all the guides here, they all seem to point to the same libraries I already have except for "pip install python-ldap".
When I try to do:
pip install python-ldap
I just get the following result:
Collecting python-ldap
Using cached python-ldap-2.4.25.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0c5p7fkj/python-ldap/setup.py", line 53
print name + ': ' + cfg.get('_ldap', name)
^
SyntaxError: invalid syntax
----------------------------------------
Does anyone know what are the best steps I should take to get around this issue to get the library working?
I've tried doing a wget for
https://pypi.python.org/pypi/python-ldap
And I extracted the files and simply used
python setup.py install to the tar ball, but to no avail.
Any suggestions?
Found the solution from this page:
https://www.howtoinstall.co/en/ubuntu/precise/universe/python-django-auth-ldap/
The following command seems to have done the trick:
apt-get install python-django-auth-ldap

Installing Python setuptools, returning import error

I'm trying to install setuptools 0.9.7 with Python 3.3. I try to run "python setup.py", and also "python setup.py install" from a cmd window in a directory separate from my default python dir, and get back:
Traceback (most recent call last):
File "setup.py", line 5 in ?
import textwrap
ImportError: No module named textwrap
...even though I checked \Lib\ and textwrap.py is there. So then I copied textwrap.py to the directory I was trying to install setuptools from, and then get:
Traceback
File "setup.py", line 5, in ?
import textwrap
File "textwrap.py", line 404
yield (prefix + line if predicate(line) else line)
SyntaxError
...even though I can import textwrap.py just fine while working in the default Python directory. So I'm at a loss. I should say that I've tried to install two other modules and have received similar import errors, I was hoping setuptools would fix that. Any ideas?

Categories

Resources