Packaging an Agent in Volttron - python

We are trying to package an agent. These are the steps we have done:
cd volttron //go to volttron directory
source env/bin/activate //activate the terminal
volttron-pkg package examples/thermoWrite //package the agent we wrote
Here is the error message comes out:
(volttron)pi#raspberrypi:~/volttron $ volttron-pkg package examples/thermoWrite
Traceback (most recent call last):
File "setup.py", line 78, in <module>
_temp = __import__(agent_module, globals(), locals(), ['__version__'], -1)
File "/tmp/tmpI0zsTG/pkg/Agent/agent.py", line 7, in <module>
import psycopg2
ImportError: No module named psycopg2
2017-03-21 17:55:05,988 () volttron.platform.packaging ERROR: Command
'['/home/pi/volttron/env/bin/python', 'setup.py', '--no-user-cfg', '--quiet',
'bdist_wheel']' returned non-zero exit status 1
I did install psycopg2 in my system, using command: sudo apt-get install python-psycopg2 in terminal
For my understanding is we miss the module psycopg2 inside the volttron. But we have no idea how to install a module inside the volttron. We have tried copy and paste module file into ./volttron/env/lib/python2.7/site-packages, it seems not working. Someone please help. Thanks.

With the VOLTTRON environment activated run:
pip install psycopg2
That will install the python module that it is trying to import.

Related

Raspberry pi modulenotfounderror pymodbustcp

On my raspberry pi 4 I tried to code some basic stuff (like printing messages) to test out the pymodbustcp. I got the code from the pymodbustcp wiki so that shouldn't give the problem.
For some reason, it doesn't want to find the module of pymodbustcp and it gives this message below when I run the code. I think it has to do with pip but I am not sure
/home/pi/Desktop/Laadpunt/venv/bin/python /home/pi/Desktop/Laadpunt/main.py
Traceback (most recent call last):
File "/home/pi/Desktop/Laadpunt/main.py", line 7, in <module>
from pyModbusTCP.client import ModbusClient
ModuleNotFoundError: No module named 'pyModbusTCP'
Process finished with exit code 1
I installed both "sudo pip2 install pyModbusTCP" as "sudo pip3 install pyModbusTCP" in my console and that says:
pi#raspberrypi:~ $ sudo pip install pyModbusTCP
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'
pi#raspberrypi:~ $
What could be the reason for the issue and how would I fix it?? If you need any info from commands tell me which ones.
sudo pip is not the way to go to install to your venv.
You should install to your venv specifically by doing
/home/pi/Desktop/Laadpunt/venv/bin/python -m pip install ...

Python script compiled to .exe giving error: No module named yaml

I can run the code below in Pycharm without issues, but when I create an exe using pyinstaller, I get the following error when I run the executable -
**Traceback (most recent call last):
File "openfile.py", line 1, in <module>
ImportError: No module named yaml
[1296] Failed to execute script openfile**
import yaml
from sys import exit
cfg = yaml.safe_load(open("Config.yml"))
exit()
Note that I'm using Windows 10.
pip install pyyaml will solve this problem
or use virtualenv
pip install virtualenv -p python3 #or python2
virtualenv venv
venv/Scripts/activate
pip install pyyaml

ImportError: No module named pyopengv

Hi, I am having problem using openSFM. My first time....
I tried the command
bin/opensfm_run_all data/berlin
and the error comes out like this:
Running using Python command: python
Traceback (most recent call last):
File "/home/yjw/OpenSfM/bin/opensfm", line 10, in <module>
from opensfm import commands
File "/home/yjw/OpenSfM/opensfm/commands/__init__.py", line 4, in <module>
from . import match_features
File "/home/yjw/OpenSfM/opensfm/commands/match_features.py", line 9, in <module>
from opensfm import matching
File "/home/yjw/OpenSfM/opensfm/matching.py", line 3, in <module>
import pyopengv
ImportError: No module named pyopengv
It seems like pyopengv is not installed so I tried the
pip install opengv and pip3 install opengv
but then another problem comes out...
Collecting opengv
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/opengv/
Can anyone give me solution, please? Thanks is advance!!
The problem is that there is no opengv library in PyPi repository, you have to install it manually as explained here: http://laurentkneip.github.io/opengv/page_installation.html
sudo apt-get install build-essential cmake libeigen3-dev
git clone https://github.com/laurentkneip/opengv
cd opengv
mkdir build && cd build && cmake .. && make
It is an environment error. it is likely that opengv for python V3 has been installed into the python V2 folder. Please try using opengv's cmake option
cmake ../opengv -DBUILD_PYTHON=ON -DPYBIND11_PYTHON_VERSION=3.6 -DPYTHON_INSTALL_DIR=/usr/local/lib/python3.6/dist-packages/

Installation Error while installing portia

Followed instructions on the github page. Of course, had to make minor changes since I was working with a windows 7 system. I got to the point post creating the virtual environment for portia to run. And I was trying to install the required packages using pip.
pip install -r requirements.txt
It failed with a log.
Now in the shell I try to run twistd, it gives error saying command not found. I even tried as follows:
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$ python ../../portia_env/Scripts/twistd.py -n slyd
Traceback (most recent call last):
File "../../portia_env/Scripts/twistd.py", line 13, in <module>
from twisted.scripts.twistd import run
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 53, in
<module>
_checkRequirements()
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 37, in
_checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zop
e.interface.
(portia_env)
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$
Is there an alternate procedure to follow in order to make this work on windows?
It looks like zope.interface didn't install when you ran:
pip install -r requirements.txt
Could you try running the following and see if it works?
pip install zope.interface

Redhat trying to use pip ImportError: No module named pip

I am trying to use pip on my Redhat system.
I installed pip following the instructions here, but when I try to use it, for example pip install, I get the following error code:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
this issue due to common user do not have privilege to access packages py file.
1. root user can run 'pip list'
2. other common user cannot run 'pip list'
[~]$ pip list
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal import main
ImportError: No module named pip._internal
solution :
root user login and run
chmod -R 755 /usr/lib/python2.7
fix this issue.
If pip is already installed and your unable to access it, one of the reason could be that you don't have permissions to read or execute the library. Try doing
sudo chmod -R u+rx /usr/lib/python2.7/site-packages/pip/
If pip is installed in a different folder, you can obtain the folder path by doing
>>> import pip
>>> pip.__path__
['/usr/lib/python2.7/site-packages/pip']
If you don't have root rights and running on python 2.6 then you can try this file https://bootstrap.pypa.io/2.6/get-pip.py (it is from same instruction you used, it is a simple python script which installs all dependencies and pip itself) and run it with command python get-pip.py --user

Categories

Resources