Error when I import 'videosequence' in Python 3.9 - python

import glob
import os
from contextlib import closing
from videosequence import VideoSequence
from PIL import Image
import face_recognition
import subprocess
from pytube import YouTube
When I run my project in a venv in Pycharm, this error message shows up
C:/Users/usr/PycharmProjects/project/main.py
Traceback (most recent call last):
File "C:\Users\usr\PycharmProjects\project\main.py", line 4, in <module>
from videosequence import VideoSequence
File "C:\Users\usr\PycharmProjects\project\venv\lib\site-packages\videosequence\__init__.py", line 9, in <module>
import gi
ModuleNotFoundError: No module named 'gi'

From the VideoSequence GitHub page:
The implementation is based on GStreamer and so de facto only works on a modern Unix-alike such as Linux or FreeBSD.
The PyGObject introspection libraries must be installed. (See below.)
You seem to be working on Windows (I do not know whether VideoSequence does in fact work on Windows), and, crucially, it is clear PyGObject is not installed.

Related

Error Import awswrangler: AttributeError: module 'multiprocessing' has no attribute 'connection'

I have a python script that uses the lib awswrangler. Today my scrpit started to give errors in the import of the library and I don't know what is happening.
I'm running the script in a docker container with image python: 3.8
Example:
import awswrangler as wr
print(wr.__version__)
Error:
Traceback (most recent call last):
File "src/avec/automation/TaskBaseUserPass.py", line 1, in <module>
from awswrangler.pandas import Pandas
File "/usr/local/lib/python3.8/site-packages/awswrangler/__init__.py", line 17, in <module>
from awswrangler.pandas import Pandas # noqa
File "/usr/local/lib/python3.8/site-packages/awswrangler/pandas.py", line 45, in <module>
class Pandas:
File "/usr/local/lib/python3.8/site-packages/awswrangler/pandas.py", line 273, in Pandas
def _read_csv_once_remote(send_pipe: mp.connection.Connection, session_primitives: "SessionPrimitives",
AttributeError: module 'multiprocessing' has no attribute 'connection'
I have been experienced the same issue today when trying to import awswrangler. For me, downgrading the following dependencies helped:
pip install fsspec==0.6.3 PyAthena==1.10.2 s3fs==0.4.0
It seems that one or more of them were causing the problem.
If your code uses multiprocessing.connection.Listener or multiprocessing.connection.Client, then you should use:
import multiprocessing.connection
If you just use
import multiprocessing
.. then your code might get an ImportError or not. It depends on other modules. If an other module imports multiprocessing.connection, then it will work.
But I guess you don't want random behavior, and that's why you should import multiprocessing.connection.
I managed to run version 3.6, the library has a problem with mp.connection.Connection in current python versions

How to fix ImportError : DLL load failed for scipy.spatial module?

It's been a week I have been searching for an answer, but I have not found a way to solve my problem.
I'm running python 3.6 on Windows, and I have this error :
Traceback (most recent call last):
File "C:/Alexis/folder/tag_activity.py", line 10, in <module>
from scipy.spatial.distance import cdist
File "C:\Users\Alexis\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\spatial\__init__.py", line 101, in <module>
from .qhull import *
ImportError: DLL load failed: Le module spécifié est introuvable.
Here is a few lines to give context :
# In tag_activity.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
import boto3
import requests
# In scipy.spatial module
from .kdtree import *
from .ckdtree import *
from .qhull import *
from ._spherical_voronoi import SphericalVoronoi
from ._plotutils import *
I really don't understand why it doesn't works, because when I try to access .qhull.py file with CTRL+click on Pycharm, I can access the module.
I've tried to reinstall scipy with adequate .whl file (scipy-1.3.1-cp36-cp36m-win_amd64.whl) from Christoph Gohlke website, but it doesn't solve anything.
Edit : I can't install python 3.7, I'm using libraries that aren't supported, and the script will run on servers using python 3.6
try installing through with the standard command line
pip install scipy
or clone on https://files.pythonhosted.org/packages/e1/9e/454b2dab5ee21f66ebf02ddbc63c5f074b21c44e66e1a509b38566cac9d9/scipy-1.3.1-cp37-cp37m-win32.whl

How do I import NLTK to Python 3.7 on a Mac?

I have been trying to import the Natural Language Toolkit (NLTK) as per the code provided on https://www.nltk.org/install.html.
This code works on the terminal window on my mac (10.14), but refuses to import NLTK onto the interpreter provided with Python (IDLE).
I have already tried changing the directory by importing os module. (Changed the directory to the default Python library on macOS). This in turn yields errors from the NLTK scripts itself.
This is the code I ran
>>> import os
>>> os.getcwd()
>>> os.chdir('/Library/Python/2.7/site-packages')
>>> import nltk
I expected the nltk to successfully import after changing the directory.
However, it shows errors in the NLTK scripts itself (I'm assuming) which are as follows:
"Traceback (most recent call last):
File "", line 1, in
import nltk
File "/Library/Python/2.7/site-packages/nltk/init.py", line 99,
in
from nltk.internals import config_java
File "/Library/Python/2.7/site-packages/nltk/internals.py", line 28,
in
from six import string_types
ModuleNotFoundError: No module named 'six'"

Python igraph import error on Windows

I've installed igraph form .whl file using pip install. When I was trying to test the correctness of installation
import igraph.test
igraph.test.test()
I got this error:
Traceback (most recent call last):
File "D:/Nauka/Praca-inzynierska/Barabasi-Albert.py", line 4, in <module>
import igraph.test
File "D:\Programy\Python 3.5\lib\site-packages\igraph\__init__.py", line 34, in <module>
from igraph._igraph import *
ImportError: No module named 'igraph._igraph'
(the same error pops out if I'm trying to import igraph not igraph.test).
I've tried adding path (I don't know if this is rigth):
import sys
sys.path.append ("D:/Programy/Python 3.5/Lib/site-packages/igraph")
but it didn't work.
One thing I discovered is that if I delete "__init__" file from igraph folder I can import igraph without error, but it doesn't work for igraph.test.
If it's relevant I have Python 2.7 installed on my machine alongside Python 3.5.
Thank you in advance for any help.

ImportError: No module named _grabscreen

I am new to python and using this tutorial http://code.tutsplus.com/tutorials/how-to-build-a-python-bot-that-can-play-web-games--active-11117 to build a bot which plays games.
I copy-pasted the file and installed the libraries .When i tried running the file in the terminal on my mac i got this error :
Traceback (most recent call last):
File "bot.py", line 2, in <module>
import Image, ImageGrab, ImageOps
File "/Library/Python/2.7/site-packages/PIL/ImageGrab.py", line 34, in <module>
import _grabscreen
ImportError: No module named _grabscreen
Here is the complete code
import os, sys
import Image, ImageGrab, ImageOps
import time, random
from random import randrange
import win32api, win32con
from numpy import *
I think you should pay attention to the these words in the tutorial, 'Some of the code and libraries are Windows-specific. There may be Mac or Linux equivalents, but we won't be covering them in this tutorial.'.
And current version of ImageGrag only works for windows.

Categories

Resources