the yowsup library does not work when I try to register - python-3.x

I installed the next packages in my raspberry with pip3:
-python-axolotl
-protobuf
-six
-argparse
-readline
-pillow
-tqdm
-requests
-pycrypto
-blinker
Next I installed yowsup with
pip3 install yowsup
So, I download a repository, https://github.com/danielcardeenas/whatsapp-framework, (today is 2019-May-17), I live in Colombian, so I intent send the registration with:
yowsup-cli registration --requestcode sms --phone 57317509xxx --cc 57 -E android
I installed the next packages in my raspberry with pip3:
-python-axolotl
-protobuf
-six
-argparse
-readline
-pillow
-tqdm
-requests
-yowsup
-pycrypto
-blinker
next, I download a repository, https://github.com/danielcardeenas/whatsapp-framework, (today is 2019-May-17), I live in Colombian, so I intent send the registration with:
yowsup-cli registration --requestcode sms --phone 57317509xxx --cc 57 -E android
but the console print a error:
Traceback (most recent call last):
File "/usr/local/bin/yowsup-cli", line 4, in
import('pkg_resources').run_script('yowsup2==2.5.2', 'yowsup-cli')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 739, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1494, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 368, in
if not parser.process():
File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 189, in process
self.handleRequestCode(self.args["requestcode"], config)
File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 198, in handleRequestCode
from yowsup.registration import WACodeRequest
File "/usr/local/lib/python3.5/dist-packages/yowsup/registration/init.py", line 1, in
from .coderequest import WACodeRequest
File "/usr/local/lib/python3.5/dist-packages/yowsup/registration/coderequest.py", line 1, in
from yowsup.common.http.warequest import WARequest
File "/usr/local/lib/python3.5/dist-packages/yowsup/common/http/init.py", line 2, in
from .warequest import WARequest
File "/usr/local/lib/python3.5/dist-packages/yowsup/common/http/warequest.py", line 8, in
from yowsup.common.tools import WATools
File "/usr/local/lib/python3.5/dist-packages/yowsup/common/tools.py", line 10, in
from consonance.structs.keypair import KeyPair
File "/usr/local/lib/python3.5/dist-packages/consonance/structs/keypair.py", line 4, in
from dissononce.dh.x25519.x25519 import X25519DH
File "/usr/local/lib/python3.5/dist-packages/dissononce/dh/x25519/x25519.py", line 1, in
from cryptography.hazmat.primitives.asymmetric import x25519
ImportError: cannot import name 'x25519'

Had a similar issue
The problem is not with yowsup, but with its dependencies (so it couldn't import: x25519) and concretely with the cryptography library.
The following commands might help you solve it but check while installing that dependencies are solved, because there seems to be a lot of them that have to be manually solved:
pip3 install cryptography --force-reinstall
pip3 install yowsup --force-reinstall
Other commands you may have to use to solve dependencies:
pip3 install python-axolotl-curve25519
pip3 install six==1.10
Hope to at least have pointed in the right direction!

Related

AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found

I recently downloaded the OSMnx package to work with street networks. However, it always gives me back the error below whenever I try to import the package. I've followed several steps that people from other posts suggested, but nothing changes. If anyone has had this problem or knows a way to solve it, please share it with me. Thank you!
Traceback (most recent call last):
File "/Users/qle/Documents/OSMnx/test.py", line 1, in <module>
import osmnx as ox
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/__init__.py", line 3, in <module>
from ._api import *
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/_api.py", line 3, in <module>
from .bearing import add_edge_bearings
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/bearing.py", line 9, in <module>
from . import projection
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/projection.py", line 3, in <module>
import geopandas as gpd
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/__init__.py", line 1, in <module>
from geopandas._config import options # noqa
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/_config.py", line 126, in <module>
default_value=_default_use_pygeos(),
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/_config.py", line 112, in _default_use_pygeos
import geopandas._compat as compat
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/_compat.py", line 202, in <module>
import rtree # noqa
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/rtree/__init__.py", line 9, in <module>
from .index import Rtree, Index # noqa
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/rtree/index.py", line 6, in <module>
from . import core
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/rtree/core.py", line 77, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found
Your error means, that rtree, a dependency of osmnx, cannot find spatialindex.
First, make sure that spatialindex is installed:
brew install spatialindex
The next problem is that rtree only checks in very specific locations for spatialindex but brew installs to /opt/homebrew/Cellar.
You set the ENV variable and check if that's the issue with
export SPATIALINDEX_C_LIBRARY='/opt/homebrew/Cellar/spatialindex/1.9.3/lib'
python -c 'import geopandas'
and it should work.
However, depending on your spatialindex and brew version, this path might change.
The problem has been solved, and I want to share in case anyone later could try if encountering the same problem.
After I installed the latest version for rtree, which you can see below, it still gave me back the same problem
conda install -c ioos rtree=0.9.7
I had to install brew package for my Mac.
https://brew.sh
Then I ran these 2 lines of code that my friend Philippe found from another page
Installing Rtree from libspacialindex to use .clip() in geopandas
https://github.com/gboeing/osmnx/issues/3
brew install spatialindex
pip install rtree
The problem has been solved completely.
This isn't an OSMnx issue - it's an rtree issue. You might want to open an issue directly with the rtree GitHub repo. That said, you're on OS X so you may want to try to install with rtree
conda install -c ioos rtree=0.8.2
Some of my students that have macs struggled to install rtree with pip, but succeeded with that conda command if you're on windows, you can follow these instructions to install geopandas and rtree.
reference

cx_Freeze ConfigError: No file named C:\Python\Scripts\cxfreeze.exe\__main__.py (for module __main__)

I would like to create a .exe file of a file named ZCasinoinsulte.py located in C:\Python\Scripts. Moreoever, every time I execute cxfreeze ZCasinoinsulte.py it never works and tells me it does not find _main_.py in cxfreeze.exe.
Specs: I have python 3.9.1 on Windows 10 64bit.
I have installed cx_Freeze-6.5.1 with whl.
It does create an exe file, but it opens and shuts down instantly (even though I put os.system("pause") in ZCasinoinsulte.py).
old code
Any help would be appreciated :D
Edit: I have used the cxfreeze version 6.4.2 and the code runs better without errors. But the exe file closes as soon as I clic on it.
Here is my pip list traceback:
C:\Users\Hmili>pip list
Package Version
------------------ -------
cx-Freeze 6.4.2
importlib-metadata 3.4.0
pip 20.3.3
setuptools 49.2.1
zipp 3.4.0
Here is the traceback when I execute the exe file from cmd:
C:\Python\Mes fichiers python\dist>ZCasinoinsulte.exe
Traceback (most recent call last):
File "c:\python\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 41, in run
module.run()
File "c:\python\lib\site-packages\cx_Freeze\initscripts\Console.py", line 36, in run
exec(code, m.__dict__)
File "ZCasinoinsulte.py", line 3, in <module>
File "c:\python\lib\site-packages\cx_Freeze\__init__.py", line 1, in <module>
import setuptools
File "c:\python\lib\site-packages\setuptools\__init__.py", line 24, in <module>
from setuptools.depends import Require
File "c:\python\lib\site-packages\setuptools\depends.py", line 6, in <module>
from .py33compat import Bytecode
File "c:\python\lib\site-packages\setuptools\py33compat.py", line 11, in <module>
from setuptools.extern.six.moves import html_parser
File "c:\python\lib\site-packages\setuptools\_vendor\six.py", line 92, in __get__
result = self._resolve()
File "c:\python\lib\site-packages\setuptools\_vendor\six.py", line 115, in _resolve
return _import_module(self.mod)
File "c:\python\lib\site-packages\setuptools\_vendor\six.py", line 82, in _import_module
__import__(name)
ModuleNotFoundError: No module named 'html.parser'
Here are the first ten lines of ZCasinoinsulte.py:
# -*-coding:Latin-1 -*
import os,time
from cx_Freeze import setup, Executable
from random import randrange
argent=3000
while argent>0:
condition1=0
condition2=0
argent=int(argent)
How do I resolve this? (Thanks for the help by the way :) )
I reverted cx_Freeze back to version 6.4.2, seemed to compile fine after that
pip install --upgrade cx-Freeze==6.4.2
Seems to be a bug or something.
First I downgraded pip as James Mackey advised me. The code ran properly and created an exe file. So the first issue was a comptability one.
Moreover, the exe file created crashed instantly when executed. From the traceback of the execution of ZCasinoinsulte.exe with cmd, James Mackey figured the third line of ZCasinoinsulte.py had an error related to it.
The third line of ZCasinoinsulte.py was:
from cx_Freeze import setup, Executable
I erased this line as it has nothing to do with the actual code.
I opened cmd and executed again the command: cxfreeze ZCasinoinsulte.py. The exe file now functions properly.

Setting up Hydrogen and Atom with Anaconda managing python installation

I have added my python 3 executable to the system PATH (against the advice of Anaconda) to try and get Hydrogen (and really any Atom extension/plugin) to run lines or blocks of code in Atom. The 'scripts' atom plugin appears to work (I select some code and enter ctrl-shift-b), but I'd love to use more of the features in Hydrogen. When I execute (for example):
print('hello world')
I get the following error:
Python 3
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec)
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals)
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel__init__.py", line 2, in from .connect import
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\connect.py", line 18, in import jupyter_client File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client__init__.py", line 4, in from .connect import
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 23, in import zmq
File "C:\ProgramData\Anaconda3\lib\site-packages\zmq__init__.py", line 47, in from zmq import backend
File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend__init__.py", line 40, in reraise(*exc_info)
File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise raise value
File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend__init__.py", line 27, in _ns = select_backend(first)
File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend\select.py", line 27, in select_backend mod = import(name, fromlist=public_api)
File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend\cython__init__.py", line 6, in from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
I have reinstalled the package, I've tried using the Anaconda power shell and normal prompt to install and load Atom. My only guess is that its having trouble launching a kernel, or am I supposed to launch one and then connect?
End goal:
run code block and it works.
To use a Conda env as a kernel in Hydrogen you must register the env using ipykernel, e.g.,
conda activate myenv
python -m ipykernel install --user
This creates an entry for the kernel in a default user-level location that is generically visible to any Jupyter instances run by the user (such as Hydrogen). It is recommended to also include a --name NAME flag to distinguish your different envs. Please refer to the python -m ipykernel install -h for more options.
Also, note that the minimum requirement for using a Conda env as a kernel is to install ipykernel. And, yeah, clean up the PATH so that it conforms to Conda best practices - there should be no need for manually editing.

I am unable to successfully import pywinauto into python 3.6.4

I began with a pip install of "pywinauto" and attempted to import it, and I initially I got a message saying that the module win32api was missing. I attempted a pip install of that module but received a message saying that no satisfactory version could be found.
I then downloaded a copy of it from the web which when I tried to install it informed me that I don't have Python 3.6 installed on my system(!)
I had a number of installations of earlier versions and worried that they might be causing a problem so I deleted them and tried again, no success. The path to my executable is C:\Python36\python.exe.
I went to the site-packages folder and deleted the pywinauto and pywinauto-0.6.4-py3.6.egg-info folders and did a fresh pip install which concluded with the message: "Successfully installed pywinauto-0.6.4" and attempted to import it again.
This time I got the following:
import pywinauto
File "C:\Python36\lib\site-packages\pywinauto\__init__.py", line 72, in <module>
from . import findwindows
File "C:\Python36\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "C:\Python36\lib\site-packages\pywinauto\controls\__init__.py", line 36, in <module>
from . import uiawrapper # register "uia" back-end (at the end of uiawrapper module)
File "C:\Python36\lib\site-packages\pywinauto\controls\uiawrapper.py", line 46, in <module>
from ..uia_defines import IUIA
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 181, in <module>
pattern_ids = _build_pattern_ids_dic()
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 169, in _build_pattern_ids_dic
if hasattr(IUIA().ui_automation_client, cls_name):
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 50, in __call__
cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs)
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 63, in __init__
self.ui_automation_client.CUIAutomation().IPersist_GetClassID(),
AttributeError: module 'comtypes.gen.UIAutomationClient' has no attribute 'CUIAutomation'
At this point I really don't know what to do. It appears that one of the imported files is lacking something that another one needs. I would be grateful for any ideas......
The correct dependency can be installed so:
pip install pywin32
Previously it was pypiwin32 but something is changed in these packages maintenance and pywin32 became official again. pywinauto 0.6.5 will reflect these changes soon.
The second issue looks like known comtypes issue with generating cache files for UI Automation type library. The workaround assumes running the script as Administrator at least first time to have an access to comtypes cache folder. Unfortunately comtypes maintainers are not so active and there are a number of pull requests with very similar fixes and they all still hang unaccepted.

Can't install Telegram on Debian : ModuleNotFoundError: No module named 'apt_pkg'

I am Debian user.
I run the code in the shell as a root:
I want to install telegram with below command :
sudo add-apt-repository ppa:atareao/telegram
sudo apt-get update
sudo apt-get install telegram
I get the following error:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
how can I resolve it?
Thanks
Tow way to install telegram on debian:
1) The telegram package can be installed through snap.
# apt install snapd
To find a package:
snap find telegram
Sample output:
Name Version Developer Notes Summary
telegram-sergiusens 1.2.6 sergiusens - Telegram desktop client
telegram-cli 1.4.5 marius-quabeck - Command-line interface for Telegram. Uses the readline interface.
telegram-desktop 1.2.17 3v1n0 - Official desktop client for the Telegram messenger
ubuntu-social-kit 3 keshavnrj - Bring social media apps to Ubuntu Desktop
squirrelbot 1.1.2 xordspar0 - A Telegram bot that stashes away links that you send it
mup-plugins 2017.04.19 niemeyer - mup IRC and Telegram bot - plugins side
mup-accounts 2016.09.24 niemeyer - mup IRC and Telegram bot - account connection side
shell2telegram 1.7 msoap - Telegram bot constructor from command-line
To install telegram:
# snap install telegram-desktop
2) The package telegram-desktop is available on stretch-backports. Edit your /etc/apt/sources.list by adding the following line:
deb http://deb.debian.org/debian/ stretch-backports main
Save then run:
# apt update
# apt install telegram-desktop
The package is available also for debian Buster and Sid.
Remove the ppa:atareao/telegram (Under /etc/apt/sources.list.d/) and see the answer linked by #aicastell to fix the error.
why you want to download and install telegram from PPA ?!
follow me :
1) Download Telegram Desktop from Telegram.Org
2) Extract archive to /opt
3) execute /opt/Telegram/Telegram
Note : Telegram app automatically install telegramdesktop.desktop file on your application menu (~/.local/share/applications/telegramdesktop.desktop) . next time only click on icon .
FINE .

Resources