I'm actually using Matplotlib and Numpy for a Python script on a ssh.
I had to creat a virtual python3 environment on my ssh account.
then, I made: pip3 install numpy
and everything worked well:
Collecting numpy
Using cached https://files.pythonhosted.org/packages/7b/61/11b05cc37ccdaabad89f04dbdc2a02905cf6de6f9b05816dba843beed328/numpy-1.14.3-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.14.3
pip3 show numpy
Name: numpy
Version: 1.14.3
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /panhome/me/.local/lib/python3.5/site-packages
Then, in my script I put the PYTHONPATH such:
export PYTHONPATH=$PYTHONPATH:/panhome/me/.local/lib/python3.5/site-packages
but I actually get the following error:
Traceback (most recent call last):
File "/pandata/me/LEPIWASP/blast_database/public_scripts-master/Diamond_BLAST_add_taxonomic_info/Diamond_blast_to_taxid.py", line 25, in <module>
import matplotlib
File "/panhome/me/.local/lib/python3.5/site-packages/matplotlib/__init__.py", line 127, in <module>
from . import cbook
File "/panhome/me/.local/lib/python3.5/site-packages/matplotlib/cbook/__init__.py", line 35, in <module>
import numpy as np
File "/panhome/me/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/panhome/me/.local/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/panhome/me/.local/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/panhome/me/.local/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/panhome/me/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: cannot import name multiarray
I already tried to unistall numpy and reinstate it several times.
Thanks for your help.
Import command line in the script file:
# imports
from __future__ import print_function
import time
import os
import sys
from optparse import OptionParser # TODO: update to argparser
import datetime
import logging
import logging.handlers
import matplotlib
# this code added to prevent this error:
# self.tk = _tkinter.create(screenName, baseName,
# className, interactive, wantobjects, useTk, sync, use)
# _tkinter.TclError: no display name and
# no $DISPLAY environment variable
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pylab
Here is my script to run the process:
#PBS -S /bin/bash
#PBS -l nodes=1:ppn=8
#PBS -e /pandata/me/LEPIWASP/blast_database/tax_name_candidates_sp1.error
#PBS -o /pandata/me/LEPIWASP/blast_database/tax_name_candidates_sp1.out
#PBS -q q1hour
#PBS -N tax_name_candidates_sp1
export PYTHONPATH=$PYTHONPATH:/panhome/me/.local/lib/python3.5/site-packages:/usr/lib/python3/dist-packages/
diamond_tab_output=/pandata/me/LEPIWASP/blast_database/matches.m8
Diamond_blast_to_taxid=/pandata/me/LEPIWASP/blast_database/public_scripts-master/Diamond_BLAST_add_taxonomic_info/Diamond_blast_to_taxid.py
taxid=/pandata/me/LEPIWASP/blast_database/gi_taxid_prot.dmp
categories=/pandata/me/LEPIWASP/blast_database/categories.dmp
names=/pandata/me/LEPIWASP/blast_database/names.dmp
description=/pandata/me/LEPIWASP/blast_database/acc_to_des.tab
$Diamond_blast_to_taxid -i $diamond_tab_output -t $taxid -c $categories -n $names -d $description -o outfile_sp1.tab
Try
python -m pip install numpy
.If you’re intending to run of a different python binary, just substitute that in to the command above instead.
I did it :
and I stil get the same first error message :/
Run
rm -rf ~/.local/lib/python3.5/site-packages/numpy
, thenpip install
it again. On occasion you get left-over egg files and they cause weird behavior like this.I'm still getting the same message, I tried several times to uninstall numpy without sucess...
Did you start the virtual environment first?
Yep, @shoujun.gu I forgot to do it but I actually got another issue:
Your python environment seems to be broken. You'll need to reinstall python (just download conda instead).
How can I do it, I'm on a ssh environment. Can I do it the same way I did with :
???
Hello Toto26 ,
Don't forget to follow up on your threads.
If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.

Please do the same for this and your previous questions as well.