How to fix 'cannot import etree' error while executing rosrun "file - lxml

I wanted to run a python file in which I imported Lxml, but I got this error although I installed the Lxml package:
ImportError: cannot import name 'etree'
Is there a way to fix this please?

Related

import yfinance issue - numpy dependency problem? Need to uninstall then reinstall numpy every time. Code works from CLI, but not in PyCharm

I am trying to use the yfinance module. I have a venv set up. If I run my code from the command line it works. If I run it inside PyCharm it throws this import error. Doing pip uninstall -y numpy and then pip install numpy fixes the problem, but I have to do this every day. I'm very confused on what is the issue. Anyone have any tips?
It is failing at literally the first line of code which is the import yfinance line. Here is the traceback:
Traceback (most recent call last):
File "/Users/MikeGuglielmo/Desktop/python_code.py/python_distilled/practice.py/main.py", line 1, in
import yfinance as yf
File "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/lib/python3.9/site-packages/yfinance/init.py", line 23, in
from .ticker import Ticker
File "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/lib/python3.9/site-packages/yfinance/ticker.py", line 27, in
import pandas as _pd
File "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/lib/python3.9/site-packages/pandas/init.py", line 16, in
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
The Python version is: Python3.9 from "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/bin/python"
The NumPy version is: "1.23.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'

rqt_graph pyqt binding of qt_gui_cpp library

I am using ROS-melodic in ubuntu 18.04 LTS. I am getting this error:
Could not import "pyqt" bindings of qt_gui_cpp library - so C++ plugins will not be available:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui_cpp/cpp_binding_helper.py", line 43, in <module>
from . import libqt_gui_cpp_sip
ImportError: dynamic module does not define module export function (PyInit_libqt_gui_cpp_sip)
however I have installed pyqt5 and pydot manually, rqt_graph shows up but with this warning. I want to know what can I do to get it right? Is this going to be problem in future? Now rqt_graph is loading but I don't know if this will mess up/create lacking in the graph?
Try uninstalling double packages if any using
pip3 uninstall PyQt5-sip PyQt5
Then try importing it in python3 to check if any other version is there.
If the import is successful then try running the command again
rosrun rqt_graph rqt_graph
if still some error exists install
pip3 install PyQt5==5.12

Error while importing panda, but I already installed

I am getting the following error while trying to execute a python code trough a php one using Symfony:
I've already tried executing in the spyder environment, in sublime and in windows command prompt, and it works, only when I run the php code it return the error.
in import pandas as pd File "D:\Anaconda\lib\site-packages\pandas\__init__.py", line 19, in "Missing required dependencies {0}".format(missing_dependencies)) ImportError: Missing required dependencies ['numpy']

ImportError with "Import PyQt5.QtSql "

I am attempting to
from PyQt5.QtSql import QSqlDatabase, QSqlQuery
and am receiving this error:
from PyQt5.QtSql import QSqlDatabase, QSqlQuery
ImportError: No module named 'PyQt5.QtSql'
I haven't yet ran into an import problem with other PyQt5 modules. Is the QtSql module installed separately?
thanks,
There is a similar problem described at https://github.com/ghostop14/sparrow-wifi/issues/1
Solution described there is to run command
apt-get install python3-pyqt5.qtsql

py2exe 1 missing modules, readline

I have problems in py2exe. I simply want to "convert" a .py file into a .exe file, which i can easiely run on my PC, but if i run py2exe a error message appears:
Here is my setup.py:
from distutils.core import setup
import py2exe, sys, os
setup(console=['filename.py'])
And the error message it the following:
1 missing Modules
? readline imported from cmd, code, pdb
Building 'dist\filename.exe'.
error: [Errno 2] No such file or directory: 'C:\\Users\\Name\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages\\py2exe\\run_w-py3.5-win32.exe'
I hope you guys can help me ;)
greetz
May you should install readline package first.
This package dones't work in Windows by default.
If you are in Windows,You should use pyreadline instead of readline
pip install pyreadline
It works to me.