Django-Haystack elasticsearch error in index_queryset - elasticsearch

when trying to build indexes for elasticsearch on django-haystack, i get the error (full traceback below)
TypeError: index_queryset() got an unexpected keyword argument 'using'
It is on Python 2.6, Django 1.4, ElasticSearch 0.20.2. Previously i have encountered a similar prefetch error, which was the case of version mismatch between pyelasticsearch and requests library. i've tried to downgrade requests to 0.13, but no effect. pyelasticsearch is currently 0.3
any help very much appreciated!
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 184, in handle
return super(Command, self).handle(*items, **options)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 341, in handle
label_output = self.handle_label(label, **options)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 210, in handle_label
self.update_backend(label, using)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 239, in update_backend
end_date=self.end_date)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/indexes.py", line 157, in build_queryset
index_qs = self.index_queryset(using=using)
TypeError: index_queryset() got an unexpected keyword argument 'using'

The problem is in the version of django-haystack. The current version is 0.3, while few months ago it was 1.0, which is a bit of misunderstanding.
My way to solve the problem is simple and straightforward - install the latest version (0.3), then get the older version (in this case - 1.0) and simply overwrite haystack sources.
the conclusion: "older 1.0" works smooth with the latest versions of all prerequisites (pyelasticsearch, simplejson and requests), while "newer 0.3" doesn't

Related

failed to import pywin32 (even if it already installed) while starting supervisord in windows nanoserver container

I am trying to bring two process up in a windows Nanoserver container using supervisord (pip install supervisor-win )
Everything is setup in supervisord.conf, while starting it I am facing below issue,
C:\data>supervisord -n
C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\options.py:480: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (inc
luding its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
self.warnings.warn(
Traceback (most recent call last):
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\loggers.py", line 220, in _disable_inheritance_filehandler
import win32api
oduleNotFoundError: No module named 'win32api'
D
uring handling of the above exception, another exception occurred:
T
raceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\python-3.11.1-embed-amd64\Scripts\supervisord.exe\__main__.py", line 7, in <module>
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\supervisord.py", line 403, in main
go(options)
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\supervisord.py", line 415, in go
d.main()
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\supervisord.py", line 77, in main
self.options.make_logger()
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\options.py", line 1221, in make_logger
loggers.handle_file(
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\loggers.py", line 444, in handle_file
handler = RotatingFileHandler(filename, 'a', maxbytes, backups)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\loggers.py", line 211, in __init__
self._disable_inheritance_filehandler() # fix file used by others process
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python-3.11.1-embed-amd64\Lib\site-packages\supervisor\loggers.py", line 223, in _disable_inheritance_filehandler
raise ImportWarning("log rotation requires the installation of the \"pywin32\" library.\n"
ImportWarning: log rotation requires the installation of the "pywin32" library.
Download and install from https://github.com/mhammond/pywin32/releases
C:\data>
pywin32 module is already installed (tried reinstall with whl and pip anyway, that did not help)
C:\data>python -m pip show pywin32
Name: pywin32
Version: 305
Summary: Python for Window Extensions
Home-page: https://github.com/mhammond/pywin32
Author: Mark Hammond (et al)
Author-email: mhammond#skippinet.com.au
License: PSF
Location: C:\python-3.11.1-embed-amd64\Lib\site-packages
Requires:
Required-by: pypiwin32, supervisor-win
C:\data>
What could be the issue here? I see less dll files (around 400 only) in C:\Windows\System32 compared to servercore/server image (This is working fine with windows servercore image.)

OpenMDAO SimpleGADriver Run Parallel

Have some of you succeeded to run the OpenMDAO SimpleGADriver with the run parallel mod enabled?
When I am trying to run their example from the official website (https://openmdao.org/newdocs/versions/latest/features/building_blocks/drivers/genetic_algorithm.html#running-a-ga-in-parallel), it fails every time and returns me this error:
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 24, in <module>
File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\utils\hooks.py", line 130, in execute_hooks
ret = f(*args, **kwargs)
File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\core\problem.py", line 856, in run_driver
return self.driver.run()
File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\drivers\genetic_algorithm_driver.py", line 385, in run
desvar_new, obj, self._nfit = ga.execute_ga(x0, lower_bound, upper_bound, outer_bound,
File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\drivers\genetic_algorithm_driver.py", line 716, in execute_ga
x_pop = comm.bcast(x_pop, root=0)
AttributeError: 'FakeComm' object has no attribute 'bcast'
Has someone ever faced and solved this issue ?
Many thanks in advance
It looks like instead of the script using a proper MPI installation, it's using the FakeComm, which is a dummy class used if mpi4py is not installed. You should be able to pip install mpi4py and then run that example in parallel.

'azsphere tenant list' command error occurred

To check Azure Sphere tenant list, I used azsphere tenant list command, but an error occurred like below.
>azsphere tenant list --verbose
The command failed with an unexpected error. Here is the traceback:
No section: 'sphere'
Traceback (most recent call last):
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 712, in _run_job
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/cloud_exception_handler.py", line 189, in cloud_exception_handler
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 112, in handler
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/client_factory.py", line 122, in cf_tenants
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/client_factory.py", line 35, in cf_public_api
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/profile.py", line 220, in get_login_credentials
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/config.py", line 144, in get_azsphere_config_value
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/config.py", line 114, in get_global_config_value
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 97, in get
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 92, in get
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 206, in get
File "configparser.py", line 781, in get
File "configparser.py", line 1149, in _unify_values
configparser.NoSectionError: No section: 'sphere'
To open an issue, please run: 'az feedback'
Command ran in 0.159 seconds (init: 0.008, invoke: 0.151)
I have 3 Azure Sphere tenants.
When I use "Azure Sphere Classic Developer Command Prompt (Deprecated)", it works.
The environment I have been using since before, and it seems that the problem occurred after installing the latest version of the Azure Sphere SDK.
Below is the current SDK version.
>azsphere show-version
----------------
Azure Sphere SDK
================
22.02.3.41775
----------------
How can I fix this?
This is a known issue with the 22.02 SDK and will be fixed in the next release. For now, if you login into the CLI (azsphere login), this issue will be resolved.

YFinance JSONDecodeError--latest version

When I tried to dowload historic data, I get the following error message:
Exception in thread Thread-6:
Traceback (most recent call last):
File "E:\Anaconda\envs\finrl\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "E:\Anaconda\envs\finrl\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "E:\Anaconda\envs\finrl\lib\site-packages\multitasking\__init__.py", line 104, in _run_via_pool
return callee(*args, **kwargs)
File "E:\Anaconda\envs\finrl\lib\site-packages\yfinance\multi.py", line 169, in _download_one_threaded
data = _download_one(ticker, start, end, auto_adjust, back_adjust,
File "E:\Anaconda\envs\finrl\lib\site-packages\yfinance\multi.py", line 181, in _download_one
return Ticker(ticker).history(period=period, interval=interval,
File "E:\Anaconda\envs\finrl\lib\site-packages\yfinance\base.py", line 162, in history
data = data.json()
File "E:\Anaconda\envs\finrl\lib\site-packages\requests\models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "E:\Anaconda\envs\finrl\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "E:\Anaconda\envs\finrl\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "E:\Anaconda\envs\finrl\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
here is my code:
import yfinance as yf
data = yf.download("SPY AAPL", start="2017-01-01", end="2017-04-30")
I have tried many methods:
install the latest version of yfinance
install the old version of yfinance
revise the code
In fact, when I use yahoo_fin, the same error occurs too.
Wish someone to help me solve this problem
your code is correct.
This is happening because Anaconda is used to simulate an environment so packets have determined versions so that everything is compatible. The thing that happens in your case is that yfinance is older and your version of JSON is not compatible with some functions of yfinance since yfinance is no anymore updated.
I recommend you to just install on your computer with pip the packet yfinance as follows instead of using the environment of anaconda:
pip install yfinance
and then it should try to get the correct versions of the libraries that it needs. After that, you can create a python file and then import the packet
import yfinance as yf
and then execute your download code
data = yf.download("SPY AAPL", start="2017-01-01", end="2017-04-30")
As a recommendation, try to pass different values as a list instead of a string, because it will be hard to debug later. Instead of "SPY AAPL" -> ['SPY', 'AAPL']
Edit: Also it can be that your finance version is YEARS old (but I don't think so), is this is the case then you should try to update inside of the anaconda updater. Otherwise, with the terminal, it would be something like:
pip install yfinance --upgrade

Spacy and sputnik issue on Python3

I am currently using space(0.101.0), tensorflox (1.0.0) and sputnik (0.9.3). I do have this issue happening :
super(Pool, self).__init__(app_name, app_version, path, **kwargs)
File "/Users/sebastien/xxx/venv/lib/python3.6/site-packages/sputnik/package_list.py", line 33, in __init__
self.load()
File "/Users/sebastien/xxx/venv/lib/python3.6/site-packages/sputnik/package_list.py", line 51, in load
for package in self.packages():
File "/Users/sebastien/xxx/venv/lib/python3.6/site-packages/sputnik/package_list.py", line 47, in packages
yield self.__class__.package_class(path=os.path.join(self.path, path))
File "/Users/sebastien/xxx/venv/lib/python3.6/site-packages/sputnik/package.py", line 15, in __init__
super(Package, self).__init__(defaults=meta['package'])
KeyError: 'package'
I have tried to combine different version but my make stuff is no more working. I have issues to build the overall system.
Based on what I gave as version used, This issue also happened when I am running the "python3 -m spacy.en.download"
Any idea?

Resources