Module requests not found in dataflow runner - python

I am building a pipeline on dataflow that sends recieved messages from pubsub, transforms them by making an api call and then writes them to big query.
Writing from pubsub to bigquery without the api call works perfectly fine. However when i try to use the requests library it always gives me the following error:
NameError: name 'requests' is not defined [while running 'CustomParse-ptransform-11727']
passed through:
==>
dist_proc/dax/workflow/worker/fnapi_service.cc:631
generic::unknown: Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1233, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 581, in apache_beam.runners.common.SimpleInvoker.invoke_process
File "apache_beam/runners/common.py", line 1368, in apache_beam.runners.common._OutputProcessor.process_outputs
File "PubSub2BQ.py", line 43, in process
here is the relevant code:
import argparse
import json
import requests
import os
import logging
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions, StandardOptions
class MtToJson(beam.DoFn):
def __init__(self):
pass
def process(self, message):
x = requests.post('serverAdress', data=message)
yield x.text
def run():
# Parsing arguments
parser = argparse.ArgumentParser()
parser.add_argument(
"--input_subscription",
help='Input PubSub subscription of the form "projects/<PROJECT>/subscriptions/<SUBSCRIPTION>."',
default=INPUT_SUBSCRIPTION,
)
parser.add_argument(
"--output_table", help="Output BigQuery Table", default=BIGQUERY_TABLE
)
parser.add_argument(
"--output_schema",
help="Output BigQuery Schema in text format",
default=BIGQUERY_SCHEMA,
)
known_args, pipeline_args = parser.parse_known_args()
# Creating pipeline options
pipeline_options = PipelineOptions(pipeline_args)
pipeline_options.view_as(StandardOptions).streaming = True
# Defining our pipeline and its steps
with beam.Pipeline(options=pipeline_options) as p:
(
p
| "ReadFromPubSub" >> beam.io.gcp.pubsub.ReadFromPubSub(
subscription=known_args.input_subscription, timestamp_attribute=None )
| "CustomParse" >> beam.ParDo(MtToJson())
| "WriteToBigQuery" >> beam.io.WriteToBigQuery(
known_args.output_table,
schema=known_args.output_schema,
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
)
)
Server adress omited.
I verified that requests is intalled on gcp and it is for python 2.7 and 3.7.
i am running the dataflow runner with requirements.txt that includes the requests module but it does not seem that its getting installed.
EDIT:
I changed the version of the apache sdk to a lower version:
requirements.txt
requests>=2.20.1
apache-beam[gcp]==2.25.0
and am getting the new huge error message:
File "/usr/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'download', '--dest', '/tmp/dataflow-requirements-cache', '-r', './requirements.txt', '--exists-action', 'i', '--no-binary', ':all:']' returned non-zero exit status 1.
Pip install failed for package: -r
Output from execution of subprocess: b'Collecting requests>=2.20.1\n File was already downloaded /tmp/dataflow-requirements-cache/requests-2.25.1.tar.gz\nCollecting httplib2>=0.17.2\n File was already downloaded /tmp/dataflow-requirements-cache/httplib2-0.19.1.tar.gz\n Installing build dependencies: started\n Installing build dependencies: finished with status \'done\'\n Getting requirements to build wheel: started\n Getting requirements to build wheel: finished with status \'done\'\n Preparing wheel metadata: started\n Preparing wheel metadata: finished with status \'done\'\nCollecting apache-beam[gcp]==2.25.0\n File was already downloaded /tmp/dataflow-requirements-cache/apache-beam-2.25.0.zip\nCollecting certifi>=2017.4.17\n File was already downloaded /tmp/dataflow-requirements-cache/certifi-2021.5.30.tar.gz\nCollecting chardet<5,>=3.0.2\n File was already downloaded /tmp/dataflow-requirements-cache/chardet-4.0.0.tar.gz\nCollecting idna<3,>=2.5\n File was already downloaded /tmp/dataflow-requirements-cache/idna-2.10.tar.gz\nCollecting urllib3<1.27,>=1.21.1\n File was already downloaded /tmp/dataflow-requirements-cache/urllib3-1.26.5.tar.gz\nCollecting pyparsing<3,>=2.4.2\n File was already downloaded /tmp/dataflow-requirements-cache/pyparsing-2.4.7.tar.gz\nCollecting crcmod<2.0,>=1.7\n File was already downloaded /tmp/dataflow-requirements-cache/crcmod-1.7.tar.gz\nCollecting dill<0.3.2,>=0.3.1.1\n File was already downloaded /tmp/dataflow-requirements-cache/dill-0.3.1.1.tar.gz\nCollecting fastavro<2,>=0.21.4\n File was already downloaded /tmp/dataflow-requirements-cache/fastavro-1.4.1.tar.gz\nCollecting future<1.0.0,>=0.18.2\n File was already downloaded /tmp/dataflow-requirements-cache/future-0.18.2.tar.gz\nCollecting grpcio<2,>=1.29.0\n File was already downloaded /tmp/dataflow-requirements-cache/grpcio-1.38.0.tar.gz\nCollecting hdfs<3.0.0,>=2.1.0\n File was already downloaded /tmp/dataflow-requirements-cache/hdfs-2.6.0.tar.gz\nCollecting mock<3.0.0,>=1.0.1\n File was already downloaded /tmp/dataflow-requirements-cache/mock-2.0.0.tar.gz\nCollecting numpy<2,>=1.14.3\n File was already downloaded /tmp/dataflow-requirements-cache/numpy-1.20.3.zip\n Installing build dependencies: started\n Installing build dependencies: still running...\n Installing build dependencies: finished with status \'done\'\n Getting requirements to build wheel: started\n Getting requirements to build wheel: finished with status \'done\'\n Preparing wheel metadata: started\n Preparing wheel metadata: finished with status \'done\'\nCollecting oauth2client<5,>=2.0.1\n File was already downloaded /tmp/dataflow-requirements-cache/oauth2client-4.1.3.tar.gz\nCollecting protobuf<4,>=3.12.2\n File was already downloaded /tmp/dataflow-requirements-cache/protobuf-3.17.3.tar.gz\nCollecting pydot<2,>=1.2.0\n File was already downloaded /tmp/dataflow-requirements-cache/pydot-1.4.2.tar.gz\nCollecting pymongo<4.0.0,>=3.8.0\n File was already downloaded /tmp/dataflow-requirements-cache/pymongo-3.11.4.tar.gz\nCollecting python-dateutil<3,>=2.8.0\n File was already downloaded /tmp/dataflow-requirements-cache/python-dateutil-2.8.1.tar.gz\n Installing build dependencies: started\n Installing build dependencies: finished with status \'done\'\n Getting requirements to build wheel: started\n Getting requirements to build wheel: finished with status \'done\'\n Preparing wheel metadata: started\n Preparing wheel metadata: finished with status \'done\'\nCollecting pytz>=2018.3\n File was already downloaded /tmp/dataflow-requirements-cache/pytz-2021.1.tar.gz\nCollecting typing-extensions<3.8.0,>=3.7.0\n File was already downloaded /tmp/dataflow-requirements-cache/typing_extensions-3.7.4.3.tar.gz\nCollecting avro-python3!=1.9.2,<1.10.0,>=1.8.1\n File was already downloaded /tmp/dataflow-requirements-cache/avro-python3-1.9.2.1.tar.gz\nCollecting pyarrow<0.18.0,>=0.15.1\n File was already downloaded /tmp/dataflow-requirements-cache/pyarrow-0.17.1.tar.gz\n Installing build dependencies: started\n Installing build dependencies: still running...\n Installing build dependencies: still running...\n Installing build dependencies: finished with status \'done\'\n Getting requirements to build wheel: started\n Getting requirements to build wheel: finished with status \'done\'\n Preparing wheel metadata: started\n Preparing wheel metadata: finished with status \'done\'\nCollecting cachetools<5,>=3.1.0\n File was already downloaded /tmp/dataflow-requirements-cache/cachetools-4.2.2.tar.gz\n Installing build dependencies: started\n Installing build dependencies: finished with status \'done\'\n Getting requirements to build wheel: started\n Getting requirements to build wheel: finished with status \'done\'\n Preparing wheel metadata: started\n Preparing wheel metadata: finished with status \'done\'\nCollecting google-apitools<0.5.32,>=0.5.31\n File was already downloaded /tmp/dataflow-requirements-cache/google-apitools-0.5.31.tar.gz\nCollecting google-auth<2,>=1.18.0\n File was already downloaded /tmp/dataflow-requirements-cache/google-auth-1.30.2.tar.gz\nCollecting google-cloud-bigquery<2,>=1.6.0\n File was already downloaded /tmp/dataflow-requirements-cache/google-cloud-bigquery-1.28.0.tar.gz\nCollecting google-cloud-bigtable<2,>=0.31.1\n File was already downloaded /tmp/dataflow-requirements-cache/google-cloud-bigtable-
It seems that it wants to download a bunch of packages that i long removed from the requirements file. Is there a way to clear the cache?

Related

Install pyarrow in VS Code for Windows

I am trying to install pyarrow v10.0.0 to a Python 3.11.0 project in both IntelliJ and VS Code. I am using v1.73.0 of VS Code on WIndows 11.
We use a custom JFrog instance to pull all the libraries. To pull the libraries we use the pip manager extension.
I have version 0.38.0 of wheel.
At the top of the output log is the following error message.
Using cached https://xxxjrog.com/artifactory/api/pypi/ENT_WDA_python_virtual/packages/packages/bd/3d/9594c09e1e2fe2e5ed7ef5c22e4347fee2ea243bccd960442e2c97731fd2/pyarrow-10.0.0.tar.gz (994 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy>=1.16.6 in c:\users\app1dwg\appdata\local\programs\python\python311\lib\site-packages (from pyarrow) (1.23.4)
Building wheels for collected packages: pyarrow
Building wheel for pyarrow (pyproject.toml): started
Building wheel for pyarrow (pyproject.toml): finished with status 'error'
Failed to build pyarrow
ERROR: Command errored out with exit status 1:
At the bottom of the output is the following error. I noticed it was using Visual Studio 15 2017 Win64", but I have upgraded to the most recent version of the MS build tools as was suggested in another post.
-- Running CMake for PyArrow C++ cmake -DARROW_BUILD_DIR=build -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=C:\Users\app1dwg\AppData\Local\Temp\pip-install-399aazc6\pyarrow_6bd82e73181f4c8985e52c102dc8bb5e\build\dist
-DPYTHON_EXECUTABLE=C:\Users\app1dwg\AppData\Local\Programs\Python\Python311\python.exe
-DPython3_EXECUTABLE=C:\Users\app1dwg\AppData\Local\Programs\Python\Python311\python.exe
-DPYARROW_CXXFLAGS= -DPYARROW_WITH_DATASET=off -DPYARROW_WITH_PARQUET_ENCRYPTION=off -DPYARROW_WITH_HDFS=off -G "Visual Studio 15 2017 Win64"
C:\Users\app1dwg\AppData\Local\Temp\pip-install-399aazc6\pyarrow_6bd82e73181f4c8985e52c102dc8bb5e\pyarrow/src error: command 'cmake' failed: None
---------------------------------------- ERROR: Failed building wheel for pyarrow
ERROR: Could not build wheels for pyarrow, which is required to
install pyproject.toml-based projects
Any idea what I am doing wrong?
Thanks,
David
Try to use Python version below 3.11.0. According to the content mentioned in github, the package pyarrow does not support Python version 3.11.0 at present

Failed to install Calliope

I am trying to install the package calliope on python 3.7 using pycharm and I am getting this error that I don't understand. I also tryed o install it via anaconda but still I am getting the same problem. Any help please would be highly appreciated. It is really imporant where I need this package to run a program about energy management.
Collecting calliope
Using cached calliope-0.6.8.tar.gz (725 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting xarray<0.21,>=0.20
Using cached xarray-0.20.2-py3-none-any.whl (845 kB)
Collecting plotly<3.11,>=3.10
Using cached plotly-3.10.0-py2.py3-none-any.whl (41.5 MB)
Collecting netcdf4>=1.2.2
Using cached netCDF4-1.6.2.tar.gz (777 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
[33 lines of output]
reading from setup.cfg...
HDF5_DIR environment variable not set, checking some standard locations ..
checking C:\Users\m.haddad\include ...
hdf5 headers not found in C:\Users\m.haddad\include
checking /usr/local\include ...
hdf5 headers not found in /usr/local\include
checking /sw\include ...
hdf5 headers not found in /sw\include
checking /opt\include ...
hdf5 headers not found in /opt\include
checking /opt/local\include ...
hdf5 headers not found in /opt/local\include
checking /opt/homebrew\include ...
hdf5 headers not found in /opt/homebrew\include
checking /usr\include ...
hdf5 headers not found in /usr\include
Traceback (most recent call last):
File "C:\Users\m.haddad\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
main()
File "C:\Users\m.haddad\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\m.haddad\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\ME920~1.HAD\AppData\Local\Temp\pip-build-env-6qd6b_6t\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users\ME920~1.HAD\AppData\Local\Temp\pip-build-env-6qd6b_6t\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "C:\Users\ME920~1.HAD\AppData\Local\Temp\pip-build-env-6qd6b_6t\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 449, in <module>
File "<string>", line 390, in _populate_hdf5_info
ValueError: did not find HDF5 headers
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Thank you everyone
Download HDF5 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.1/bin/windows/
Set the environment variable HDF5_DIR to C:/Program Files/HDF_Group/HDF5/<your unzipped location>

Can't install Pyinstaller through pip

I am reasonably new to python and want to make a .exe from a .py.
However when i try to install pyinstaller with pip i get the following error:
I tried numerous things but cant resolve it.
Collecting pyinstaller
Using cached pyinstaller-5.2-py3-none-win_amd64.whl (1.2 MB)
Collecting pyinstaller-hooks-contrib>=2021.4
Using cached pyinstaller_hooks_contrib-2022.8-py2.py3-none-any.whl (239 kB)
Collecting pefile>=2022.5.30
Using cached pefile-2022.5.30.tar.gz (72 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: setuptools in c:\program files\spyder\pkgs (from pyinstaller) (62.3.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\program files\spyder\pkgs (from pyinstaller) (0.2.0)
Collecting altgraph
Using cached altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting future
Using cached future-0.18.2.tar.gz (829 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Z640179\AppData\Local\Temp\pip-install-klih4e96\future_d33b369ed28249c0b3c49bd67cf826d5\setup.py", line 86, in <module>
import src.future
ModuleNotFoundError: No module named 'src'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for detail
Does anybody know how to resolve this ?
EDIT: i tried installing SRC but got the following problem:
Collecting src
Using cached src-0.0.7.zip (6.3 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: src
Building wheel for src (setup.py): started
Building wheel for src (setup.py): finished with status 'error'
Running setup.py clean for src
Failed to build src
Installing collected packages: src
Running setup.py install for src: started
Running setup.py install for src: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error
python setup.py bdist_wheel did not run successfully.
exit code: 1
[49 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\src
copying src\__init__.py -> build\lib\src
running egg_info
writing src.egg-info\PKG-INFO
writing dependency_links to src.egg-info\dependency_links.txt
deleting src.egg-info\entry_points.txt
writing requirements to src.egg-info\requires.txt
writing top-level names to src.egg-info\top_level.txt
reading manifest file 'src.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.rst'
writing manifest file 'src.egg-info\SOURCES.txt'
C:\Program Files\Spyder\pkgs\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Z640179\AppData\Local\Temp\pip-install-knke7ajt\src_eb79a5c109004a059d46335d661a3522\setup.py", line 70, in <module>
setup(
File "C:\Program Files\Spyder\pkgs\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Program Files\Spyder\pkgs\setuptools\dist.py", line 1229, in run_command
super().run_command(command)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Program Files\Spyder\pkgs\wheel\bdist_wheel.py", line 301, in run
install = self.reinitialize_command('install',
File "C:\Program Files\Spyder\pkgs\setuptools\__init__.py", line 142, in reinitialize_command
cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\cmd.py", line 305, in reinitialize_command
return self.distribution.reinitialize_command(command,
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 951, in reinitialize_command
for sub in command.get_sub_commands():
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\cmd.py", line 324, in get_sub_commands
if method is None or method(self):
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\command\install.py", line 756, in has_lib
return (self.distribution.has_pure_modules() or
AttributeError: 'NoneType' object has no attribute 'has_pure_modules'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for src
error: subprocess-exited-with-error
Running setup.py install for src did not run successfully.
exit code: 1
[2 lines of output]
running install
You've probably made a mistake here and are trying to install from a 'src' directory which doesn't exist.
[end of output]
I tried to update wheel but it is already up to date.
Looks like you need to install src.
Pip install src
Pyinstaller can’t convert a file to an exe if a required packages isn’t installed.

Error: PyDictionary would not install on Python 3.10.2

I use pycharm ide for coding, But when I tried installing PyDictionary module it gave this error on console:
The system is running windows10 with Python version 3.10.2 with latest pip and setuptool. All necessary path variables are set and other modules import and install without issues. This case is happening only with python 3.10.2
Collecting PyDictionary
Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Collecting goslate
Using cached goslate-1.5.2.tar.gz (16 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting bs4
Using cached bs4-0.0.1.tar.gz (1.1 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting click
Using cached click-8.0.4-py3-none-any.whl (97 kB)
Requirement already satisfied: requests in c:\users\sysadmin\appdata\local\programs\python\python310\lib\site-packages (from PyDictionary) (2.27.1)
Collecting beautifulsoup4
Using cached beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Collecting colorama
Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting futures
Using cached futures-3.0.5.tar.gz (25 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[27 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 244, in <module>
monkey.patch_all()
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
patch_for_msvc_specialized_compiler()
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 169, in patch_for_msvc_specialized_compiler
patch_func(*msvc14('_get_vc_env'))
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 149, in patch_params
mod = import_module(mod_name)
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
import unittest.mock
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\unittest\mock.py", line 26, in <module>
import asyncio
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 18, in <module>
import concurrent.futures
File "C:\Users\sysadmin\AppData\Local\Temp\pip-install-ucxsouan\futures_c24a44afb56f439e8f819b7a8a5ff59d\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\sysadmin\AppData\Local\Temp\pip-install-ucxsouan\futures_c24a44afb56f439e8f819b7a8a5ff59d\concurrent\futures\_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I tried the same on windows command shell with admin privileges. But same. Anyone has the same issue?
For me upgrading setuptools solved it.
python3 -m pip install --upgrade pip setuptools
PyDictionary depends on goslate which is dependant on futures, since futures is not supported by Python 3 it causes error.
One way of preventing this is to install goslate directly from the GitHub Repository, here is the link. But you will not get the latest version.
First install goslate from GitHub Repository:
pip install -e git+https://github.com/yeahwhat-mc/goslate#egg=goslate
Then install PyDictionary:
pip install PyDictionary
Try going with wordhoard or py-dictionary
pip install wordhoard
pip install Py-Dictionary
and you can perform the operations. Below I have found the synonym of the word
inp_word = "name"
dict = Dictionary(inp_word,50)
#Py-dictionary
for i in dict.synonyms():
syn_words.append(i)
#wordhoard
for i in Synonyms(inp_word).find_synonyms():
syn_words.append(i)
print(set(syn_words))
Mostly both will have same results but I don't want to leave out things so only I am using combinedly

Pip install chatterbot

i am having immense difficulty installing chatterbot i receive an error code saying "Failed building wheel for srsly python" and i have no idea how to fix this. I have attempted to find ways to fix this using similar questions i found on SO but no results work.
One solution told me to do a manually pip install spacy but that is where i get before i get an error code with multiple failed to install x, y, z.
I get this each time i try to run the pip install spacy
ERROR: Command errored out with exit status 1:
Complete output (267 lines):
Collecting setuptools
Using cached setuptools-57.4.0-py3-none-any.whl (819 kB)
Collecting cython<3.0,>=0.25
Using cached Cython-0.29.24-cp39-cp39-win32.whl (1.6 MB)
Collecting cymem<2.1.0,>=2.0.2
Using cached cymem-2.0.5.tar.gz (9.2 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting preshed<3.1.0,>=3.0.2
Downloading preshed-3.0.5.tar.gz (14 kB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
cwd: None
Complete output (82 lines):
Collecting setuptools
Using cached setuptools-57.4.0-py3-none-any.whl (819 kB)
Collecting cython>=0.28
Using cached Cython-0.29.24-cp39-cp39-win32.whl (1.6 MB)
Collecting cymem<2.1.0,>=2.0.2
Using cached cymem-2.0.5.tar.gz (9.2 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting murmurhash<1.1.0,>=0.28.0
Using cached murmurhash-1.0.5.tar.gz (12 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: cymem, murmurhash
Building wheel for cymem (PEP 517): started
Building wheel for cymem (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
Complete output (17 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.9
creating build\lib.win32-3.9\cymem
copying cymem\about.py -> build\lib.win32-3.9\cymem
copying cymem\__init__.py -> build\lib.win32-3.9\cymem
package init file 'cymem\tests\__init__.py' not found (or not a regular file)
creating build\lib.win32-3.9\cymem\tests
copying cymem\tests\test_import.py -> build\lib.win32-3.9\cymem\tests
copying cymem\cymem.pyx -> build\lib.win32-3.9\cymem
copying cymem\cymem.pxd -> build\lib.win32-3.9\cymem
copying cymem\__init__.pxd -> build\lib.win32-3.9\cymem
running build_ext
building 'cymem.cymem' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for cymem
Building wheel for murmurhash (PEP 517): started
Building wheel for murmurhash (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
Complete output (22 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.9
creating build\lib.win32-3.9\murmurhash
copying murmurhash\about.py -> build\lib.win32-3.9\murmurhash
copying murmurhash\__init__.py -> build\lib.win32-3.9\murmurhash
creating build\lib.win32-3.9\murmurhash\tests
copying murmurhash\tests\test_against_mmh3.py -> build\lib.win32-3.9\murmurhash\tests
copying murmurhash\tests\test_import.py -> build\lib.win32-3.9\murmurhash\tests
copying murmurhash\tests\__init__.py -> build\lib.win32-3.9\murmurhash\tests
copying murmurhash\mrmr.pyx -> build\lib.win32-3.9\murmurhash
copying murmurhash\mrmr.pxd -> build\lib.win32-3.9\murmurhash
copying murmurhash\__init__.pxd -> build\lib.win32-3.9\murmurhash
creating build\lib.win32-3.9\murmurhash\include
creating build\lib.win32-3.9\murmurhash\include\murmurhash
copying murmurhash\include\murmurhash\MurmurHash2.h -> build\lib.win32-3.9\murmurhash\include\murmurhash
copying murmurhash\include\murmurhash\MurmurHash3.h -> build\lib.win32-3.9\murmurhash\include\murmurhash
running build_ext
building 'murmurhash.mrmr' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for murmurhash
Failed to build cymem murmurhash
ERROR: Could not build wheels for cymem, murmurhash which use PEP 517 and cannot be installed directly
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/ee/87/cabd3dc3d7ebd9b62252faca25ec5f1fec627ea88ca7ffd2924d02e1516e/preshed-3.0.5.tar.gz#sha256=c6d3dba39ed5059aaf99767017b9568c75b2d0780c3481e204b1daecde00360e (from https://pypi.org/simple/preshed/). Command errored out with exit status 1: ignore-installed --no-user --prefix --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'cython>=0.28' 'cymem>=2.0.2,<2.1.0' 'murmurhash>=0.28.0,<1.1.0' Check the logs for full command output.
Downloading preshed-3.0.4.tar.gz (170 kB)
ERROR: Command errored out with exit status 1:
Complete output (56 lines):
ERROR: Command errored out with exit status 1:
Complete output (17 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.9
creating build\lib.win32-3.9\cymem
copying cymem\about.py -> build\lib.win32-3.9\cymem
copying cymem\__init__.py -> build\lib.win32-3.9\cymem
package init file 'cymem\tests\__init__.py' not found (or not a regular file)
creating build\lib.win32-3.9\cymem\tests
copying cymem\tests\test_import.py -> build\lib.win32-3.9\cymem\tests
copying cymem\cymem.pyx -> build\lib.win32-3.9\cymem
copying cymem\cymem.pxd -> build\lib.win32-3.9\cymem
copying cymem\__init__.pxd -> build\lib.win32-3.9\cymem
running build_ext
building 'cymem.cymem' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for cymem
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
subprocess.check_call(cmd)
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
_install_setup_requires(attrs)
dist.fetch_build_eggs(dist.setup_requires)
resolved_dists = pkg_resources.working_set.resolve(
packages\pkg_resources\__init__.py", line 766, in resolve
dist = best[req.key] = env.best_match(
packages\pkg_resources\__init__.py", line 1051, in best_match
return self.obtain(req, installer)
packages\pkg_resources\__init__.py", line 1063, in obtain
return installer(requirement)
, line 844, in fetch_build_egg
return fetch_build_egg(self, req)
packages\setuptools\installer.py", line 77, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command
disable-pip-version-check', 'wheel', '--no-deps', '-w', non-zero exit status 1.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/8a/25/73d38655125d46a543656c0f025b3394a2ee010af3d0c46ed75d554bc1a9/preshed-3.0.4.tar.gz#sha256=13a779205d55ce323976ac06df597f9ec2d6f0563ebcf5652176cf4520c7d540 (from https://pypi.org/simple/preshed/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading preshed-3.0.3.tar.gz (170 kB)
Collecting murmurhash<1.1.0,>=0.28.0
Using cached murmurhash-1.0.5.tar.gz (12 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting thinc<8.1.0,>=8.0.8
Downloading thinc-8.0.8.tar.gz (166 kB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 2:
Complete output (73 lines):
Collecting setuptools
Using cached setuptools-57.4.0-py3-none-any.whl (819 kB)
Collecting cython<3.0,>=0.25
Using cached Cython-0.29.24-cp39-cp39-win32.whl (1.6 MB)
Collecting murmurhash<1.1.0,>=0.28.0
Using cached murmurhash-1.0.5.tar.gz (12 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting cymem<2.1.0,>=2.0.2
Using cached cymem-2.0.5.tar.gz (9.2 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting preshed<3.1.0,>=3.0.2
Using cached preshed-3.0.5.tar.gz (14 kB)
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\commands\install.py", line 315, in run
requirement_set = resolver.resolve(
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_vendor\resolvelib\resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\found_candidates.py", line 140, in __bool__
return any(self)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\found_candidates.py", line 128, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\found_candidates.py", line 32, in _iter_built
candidate = func()
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\factory.py", line 204, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\candidates.py", line 295, in __init__
super().__init__(
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\candidates.py", line 227, in _prepare
dist = self._prepare_distribution()
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\resolution\resolvelib\candidates.py", line 305, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\operations\prepare.py", line 508, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\operations\prepare.py", line 570, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\operations\prepare.py", line 59, in _get_prepared_distribution
with req_tracker.track(req):
File "c:\users\ben\appdata\local\programs\python\python39-32\lib\contextlib.py", line 117, in __enter__
return next(self.gen)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\req\req_tracker.py", line 128, in track
self.add(req)
File "C:\Users\Ben\AppData\Local\Temp\pip-standalone-pip-pb8rm6xt\__env_pip__.zip\pip\_internal\req\req_tracker.py", line 97, in add
raise LookupError(message)
LookupError: https://files.pythonhosted.org/packages/ee/87/cabd3dc3d7ebd9b62252faca25ec5f1fec627ea88ca7ffd2924d02e1516e/preshed-3.0.5.tar.gz#sha256=c6d3dba39ed5059aaf99767017b9568c75b2d0780c3481e204b1daecde00360e (from https://pypi.org/simple/preshed/) is already being built: preshed<3.1.0,>=3.0.2 from https://files.pythonhosted.org/packages/ee/87/cabd3dc3d7ebd9b62252faca25ec5f1fec627ea88ca7ffd2924d02e1516e/preshed-3.0.5.tar.gz#sha256=c6d3dba39ed5059aaf99767017b9568c75b2d0780c3481e204b1daecde00360e
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/4a/b5/c6fa6b59dae1f007dc7d4270d2c9d275473d6c9c1f092353a2159e54afd0/thinc-8.0.8.tar.gz#sha256=cf2abbd99c56f21b8804f31f995460515d95a5c5988be39e0964469e0070987b (from https://pypi.org/simple/thinc/) (requires-python:>=3.6). Command errored out with exit status 2
ERROR: Could not find a version that satisfies the requirement thinc<8.1.0,>=8.0.8 (from versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.41, 1.42, 1.60, 1.61, 1.62, 1.63, 1.64, 1.65, 1.66, 1.67, 1.68, 1.69, 1.70, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 2.0, 3.0, 3.1, 3.2, 3.3, 3.4.1, 4.0.0, 4.1.0, 4.2.0, 5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 6.0.0, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.2.0, 6.3.0, 6.4.0, 6.5.0, 6.5.2, 6.6.0, 6.7.0, 6.7.1, 6.7.2, 6.7.3, 6.8.0, 6.8.1, 6.8.2, 6.9.0, 6.10.0, 6.10.1.dev0, 6.10.1, 6.10.2.dev0, 6.10.2.dev1, 6.10.2, 6.10.3.dev0, 6.10.3.dev1, 6.10.3, 6.10.4.dev0, 6.11.0.dev2, 6.11.1.dev0, 6.11.1.dev1, 6.11.1.dev2, 6.11.1.dev3, 6.11.1.dev4, 6.11.1.dev6, 6.11.1.dev7, 6.11.1.dev10, 6.11.1.dev11, 6.11.1.dev12, 6.11.1.dev13, 6.11.1.dev15, 6.11.1.dev16, 6.11.1.dev17, 6.11.1.dev18, 6.11.1.dev19, 6.11.1.dev20, 6.11.1, 6.11.2.dev0, 6.11.2, 6.11.3.dev1, 6.11.3.dev2, 6.12.0, 6.12.1, 7.0.0.dev0, 7.0.0.dev1, 7.0.0.dev2, 7.0.0.dev3, 7.0.0.dev4, 7.0.0.dev5, 7.0.0.dev6, 7.0.0.dev8, 7.0.0, 7.0.1.dev0, 7.0.1.dev1, 7.0.1.dev2, 7.0.1, 7.0.2, 7.0.3, 7.0.4.dev0, 7.0.4, 7.0.5.dev0, 7.0.5, 7.0.6, 7.0.7, 7.0.8, 7.1.0.dev0, 7.1.0, 7.1.1, 7.2.0.dev3, 7.2.0, 7.3.0.dev0, 7.3.0, 7.3.1, 7.4.0.dev0, 7.4.0.dev1, 7.4.0.dev2, 7.4.0, 7.4.1, 7.4.2, 7.4.3, 7.4.4, 7.4.5, 8.0.0.dev0, 8.0.0.dev2, 8.0.0.dev4, 8.0.0a0, 8.0.0a1, 8.0.0a2, 8.0.0a3, 8.0.0a6, 8.0.0a8, 8.0.0a9, 8.0.0a11, 8.0.0a12, 8.0.0a13, 8.0.0a14, 8.0.0a16, 8.0.0a17, 8.0.0a18, 8.0.0a19, 8.0.0a20, 8.0.0a21, 8.0.0a22, 8.0.0a23, 8.0.0a24, 8.0.0a25, 8.0.0a26, 8.0.0a27, 8.0.0a28, 8.0.0a29, 8.0.0a30, 8.0.0a31, 8.0.0a32, 8.0.0a33, 8.0.0a34, 8.0.0a35, 8.0.0a36, 8.0.0a40, 8.0.0a41, 8.0.0a42, 8.0.0a43, 8.0.0a44, 8.0.0rc0, 8.0.0rc1, 8.0.0rc2, 8.0.0rc3, 8.0.0rc4, 8.0.0rc5, 8.0.0rc6.dev0, 8.0.0rc6, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.0.7, 8.0.8)
ERROR: No matching distribution found for thinc<8.1.0,>=8.0.8
Thank you for any help you can give me.
You can try with the other method specified in the official ChatterBot documentation (https://chatterbot.readthedocs.io/en/stable/setup.html#installation).
That is, using command line:
git clone https://github.com/gunthercox/ChatterBot.git
pip install ./ChatterBot
Note: I hope you are aware that your Python version must be from 3.4 to 3.8, as newer versions don't seem to be supported.

Categories

Resources