Cannot import visa after installing pyvisa on Mac OS X - python

I installed python with homebrew and installed pyvisa with pip, now when I run import visa, I got the following error:
OSError: dlopen(/usr/local/vxipnp/linux/bin/libvisa.so.7, 6): image not found
It seems like it's looking for NI-VISA at wrong location, how can I fix this?
On the pyvisa website FAQ it says
Error: Image not found
This error occurs when you have provided an invalid path for the VISA library. Check that the path provided to the constructor or in the configuration file
But how do I check the path?

The file that needs modification is vpp43.py.
However, the packages of PyVISA installed from 'pip' or 'easy_install' on Mac OS will be installed under .egg file:
$ /Library/Python/2.7/site-packages/PyVISA-1.5.dev4-py2.7.egg
I could not find a way to modify this, therefore I recompiled the original code by downloading it in a given director
$ mkdir pyvisacode
$ cd pyvisacode
$ curl -OL https://github.com/hgrecco/pyvisa/tarball/master
When it is downloaded extract it by
$ tar -zxvf master
A file will be created in the same directory. Navigate to
$ cd hgrecco-pyvisa-4cbdbc9/pyvisa/legacy
and run Xcode or any other text editor
$ open -a Xcode vpp43.py
In the opened vpp43.py find
path = "/usr/local/vxipnp/linux/bin/libvisa.so.7"
Comment this line and replace it with
#path = "/usr/local/vxipnp/linux/bin/libvisa.so.7"
path = "/Library/Frameworks/visa.framework/visa"
Now you can install PyVISA by
$ cd ../../
$ sudo python setup.py install
Don't forget to run your python in 32 bit. More details can be found here http://bardagjy.com/?p=1245.
I hope this will be fixed in the next PyVISA update!
Good luck

Related

Install PyQt5.15.4 from tar.gz file

I'm trying to install PyQt5.15.4 on a remote desktop that is not connected to internet (Anaconda distribution and PyCharm installed), hence I downloaded the tar.gz files from https://pypi.org/project/PyQt5/#files and tried to use this solution : Python import library from tar.gz? (it worked for other libraries I had to install such as python-docx). The problem is that there is no setup.py file. There is a configure.py file (I imagine it roughly do the same job), so I tried in cmd :
python configure.py install --prefix=<full path folder I used for other libraries I needed>
but I get:
Usage: python configure.py [opts] [name=value] [name+=value]
configure.py: error: no such option: --prefix
Do you have a tip ?
Download PyQT5 from here. https://www.riverbankcomputing.com/pypi/packages/PyQt5/PyQt5-5.15.5.dev2108100905.tar.gz#md5=b39c03d821123c37715daffb0c1c3bb1
This will download tar.gz fie. open the terminal, CD through the relative path, paste the command here.
pip install PyQt5-5.15.5.dev2108100905.tar.gz
if you have your own tar.gz. Then use the name of that file, which will install automatically.
pip install yourfile.tar.gz
Please let me know if that works

unable to get pip to work in a shared hosting environment

I was hoping someone might be able to provide a resource that will help me install python 3.6.0 on a shared hosting account at Bluehost. I’ve tried using the documentation for python 2.7 but have been unsuccessful to date. The current state of the machine now is if I run python –V it says 2.6.6 . If, however I place:
export PATH=$HOME/python/Python-3.6.0/:$PATH
in the .bashrc file in my home directory and then run python –V it says 3.6.0 However I am unable to get pip to work. I also noticed that during the python setup procedure permission was denied on a number of files.
I am really at a lost as there seems to be very little documentation for how to do this on a shared hosting environment. Your help would be greatly appreciated.
here's a link to the instructions I followed python
I thought pip would be installed as it said pip 9.0.2 was installed but when I try to run it it say cxommand not found. When I tried easy_install pip I got back the following error message:
[Errno 30] Read-only file system: '/usr/lib/python2.6/site-packages/test-easy-install-13141.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib/python2.6/site-packages/
You cannot install the package because it is trying to install them in the system directory, and you do not have write access.
If you can, use a virtualenv. Of course this requires virtualenv be installed.
Put the virtualenv somewhere you have write access to. For example, use these instructions.
Enter the following commands to download and extract Python
3.6 to your hosting account.
mkdir ~/python
cd ~/python
wget http://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar zxfv Python-3.6.0.tgz
find ~/python -type d | xargs chmod 0755
cd Python-3.6.0
Install Python
Once extracted you can use the following commands to
configure and install Python.
./configure --prefix=$HOME/python
make
make install
Modify the .bashrc
For your local version of python to load you will need to add
it to the .bashrc file.
vim ~/.bashrc
Press i
Enter:
export PATH=$HOME/python/Python-3.6.0/:$PATH
export PYTHONPATH=$PYTHONPATH:$HOME/python/python3.6/site-packages/
Write the changes (press ESC) and close vim:
:wq
Press Enter
source ~/.bashrc
Now to use pip:
python -m pip install package-of-interest
You could also ask the system administrator to install the package for you. This might be the only real option if virtualenv hasn't been installed. Ask the administrator to install virtualenv.

Pybrain installed but runs only from terminal

Here's the problem: after a lot of struggle I managed to instal pybrain, but it runs only from terminal when I use the command export 'PYTHONPATH=$PYTHONPATH:'. When I try to import modules and write in Python (through anaconda) I get this error 'no module named pybrain'. It's as if Anaconda couldn't see that pybrain is right there. Could it be a problem with the directory?
I don't understand what it means:
"Change into the directory Pybrain directory after either checking out got or downloading and extracting the archive. There you run (possibly as a superuser on Unix systems):
$ python setup.py install"
which I found on 'http://pybrain.org/docs/quickstart/installation.html'
Use the following command to install it properly to Anaconda:
pip install -i https://pypi.binstar.org/pypi/simple pybrain
That should work. The process to find out why is lengthy, and I'll follow up soon.
Proof:
One of the issues could be that it's not permitting you to install this module.
Try this in your PyBrain directory:
sudo python setup.py install
EDIT:
To navigate within terminal to the directory you use the cd - command. Let's say PyBrain is located in your desktop:
$ (this is where you'll be initially on your terminal)
EDIT 2:
To be in your root directory to be able to navigate to any file use the ../ command until you are there (it's appear as a house on your terminal window):
$ cd ../
$ cd ../
Then navigate to the directory:
$ cd desktop/pyBrain
Or in your case:
$ cd anaconda/lib/python3.4/site-packages/pybrain-master
Further documentation about installation can be found here: https://github.com/pybrain/pybrain/wiki/installation
EDIT 3:
Removing Anaconda:
rm -rf ~/anaconda
The rm command will remove the file, and the rf will force it to be deleted (otherwise it might not delete the directory).

Failed to unpack the installation folder

I am trying to follow an Adafruit tutorial which requires installing pySerial. I am running mac 10.8 and run into this error when I try to unpack the installation folder. I go to the directory the file is placed and type:
tar -xzf pyserial-2.6.tar.gz
And then the terminal prints:
tar: Error opening archive: Failed to open 'pyserial-2.6.tar.gz'
I can't seem to find what I could be doing wrong, so any advice would be appreciated.
For those looking for the tutorial, the link can be found here: http://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector/installing-python-and-pyserial
When this error occurs. It usually means that the file cannot be found. At command line of your Terminal enter "cd downloads" and search for file pyserial-2.6.tar.gz. If the file is found, proceed by entering tar -xzf pyserial-2.6.tar.gz.
If you don't understand the terminal—or even if you do—you're going to be a lot happier using pip or easy_install than trying to do this manually. pip is better, but doesn't come built in with Apple's Python, so you'll have to install it first. Fortunately, that's pretty easy. So, let's do that:
$ sudo easy_install pip
And now:
$ sudo pip install pyserial
That will automatically download, build, and install the package for you, without you having to know anything about what directory things get downloaded to or how to run the tar command properly or anything.
And let's test it just to make sure:
$ python
Python 2.7.2 (blah blah blah … )
>>> import serial
>>> serial.VERSION
'2.6'

Help "Install" Module for Python using WGET

I am trying to setup this python library and am having a very hard time. I suspect it is because I am a hobby programmer, but I have successfully installed programs in the past using the command line. I am using Windows and Python 2.6.
The help that is shown below is taken from the website.
wget http://pypi.python.org/packages/source/y/yql/yql-0.2.tar.gz
tar -xzf yql-0.2.tar.gz
cd yql-0.2
python setup.py install
In doing a number of Google searches, it seems that this is for Unix/Mac commands. My previous process has not worked, so I am looking for all of the help I can get.
Many thanks in advance!
Brock
Here is the error:
>>> import yql
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "c:\python25\lib\site-packages\yql-0.6-py2.5.egg\yql\__init__.py", line 201, in <module>
class Public(object):
File "c:\python25\lib\site-packages\yql-0.6-py2.5.egg\yql\__init__.py", line 229, in Public
#scheme.setter
AttributeError: 'property' object has no attribute 'setter'
Those are definately Unix/Linux commands to install python module. The installation in windows is pretty much similar. Follow the instructions given below
Download the library from the website.
Extract it using Winzip or WinRAR.
It will create a directory with name like foo-0.2. The directory should contain a script named setup.py
Now open the command prompt and cd to that directory
At command prompt type following
python setup.py install
Also check the following link for more detailed instructions
http://docs.python.org/release/2.6/install/index.html
What's the error message? Also what OS are you using? The install instructions seem fine.
In Debian & in most Unix Systems you could also these -
sudo pip install <module_name> to install any module.
or sudo easy_install <module_name>
or sudo apt-get install <module_name>
or you could do what you mentioned in the question. Should work fine.
Maybe you don't have root access. Package installation needs that. Post more info for more constructive comments. All the best.
If you install setuptools first (see setuptools on pypi) and add C:\Python26\Scripts to your PATH variable you can run the following:
easy_install yql-0.2.tar.gz
after wgetting the archive.
Or even easier, without wgetting the archive, simply run:
easy_install yql
And it'll download and install the latest version of yql with all the dependencies.
The above answer for installing wget is to download wget for Python.
Download the tar file and unpack the file
Then cd to the folder and run in terminal
python setup.py install
This is to install wget into Python
Try this
import tensorflow
word2vec_path = 'YOUR LINK HERE'
word2vec = models.KeyedVectors.load_word2vec_format(word2vec_path, binary=True)

Categories

Resources