TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary - binance

How do I solve this?
TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
I'm trying to use Binance socket manager, and I'm getting this error.

Should just be a case of upgrading your websockets version from 9.1 to 10.x
pip install --upgrade websockets

I've had the same issue. My bot ran fine on MacOS, but it popped up when I installed Fedora on the Apple instead. Never resolved it before moving on to other OS's, but I don't know if it would have happened on Ubuntu or Zorin, because a PIP problem stopped me long before then.
As for my primary, an MSI gaming laptop running Windows 11, I never had the issue on the command line python, IDLE, PyCharm, Visual Studio, nor Visual Studio Code, UNTIL this morning when my laptop overheated and shutdown. When I booted up again, the system no longer recognized the modules I had been using (pandas, pytz, python-binance) and they had to be installed again (from an elevated command line, which seemed odd). Then when running the program from VS, there comes the error again. Command prompt returns the same error, however, IDLE runs the program without issue. I'm not knowledgeable enough to say how to directly fix the bug, or even why it's happening, but it seems that there may be methods of skirting it. The error reads 'As of 3.10...' so if you cannot find an application that can run it, you might try rolling it back to 3.9. Sorry I can't be of any real aid, here. Hope you find your answers. I'll keep looking, too.

I've come up with several solutions.
I created my own ticker:
play = client.get_symbol_ticker(symbol='BTCUSDT)
def start_ticker():
global play
while True:
play = client.get_symbol_ticker(symbol='BTCUSDT')
print(play['Price'])
time.sleep(1)
bsm = ThreadedWebsocketManager()
bsm.start()
start_ticker()
Now, this is just a sort of preliminary example. I've tied it into my actual trading loop and removed the print function, but store and process the data second by second. I run multiple tokens simultaneously and set the sleep at the end of the entire loop, after the condition evaluations have been processed. You can tweak the rest time after testing the duration of your loop, but overall it's hasn't ever shown to be critical for it to be off by fragments of a second. One caveat is that it only delivers the flat price, but you can check the documentation for additional queries you can pull from: Python Binance 0.2.0 Websockets Documentation
Install Python 3.9:
This is easiest on Windows, as no system processes rely on it. If you install it parallel to your current version, you'll have to take extra steps to address it rather than the later version, such as with PATH edits or virtual environments. An easy tool for this is Anaconda, which can create the virtual environment with little fuss.
I run my trader on a PC running Fedora, which has proven to be more reliable with server connections (unfortunately, Windows 11 can't keep proper time without a looping PowerShell script that manually resyncs, and I get Windows semaphore errors even with the time issue fixed). However, Fedora relies on up-to-date Python for some system functions, so you have to install the pre-3.10 version beside it an create a symbolic link and a virtual environment to run it.
Modify the python-binance module to use a different Loop function, which I believe can be done with PyCharm or Anacondas, but from what I read it's not the best of ideas and I don't see a need for it at the moment. Also, I would probably just break it.

TypeError: As of 3.10, the *loop* parameter was removed from Queue() since it is no longer necessary
I was getting this error when i try to use proxybroker package.
I just downgrade python version to 3.6.8 and now error is gone.
Maybe your error to occurred by python version.
maybe helps

Make sure u installed asyncio and imported that. I had the same problem.

Related

python scripts are too slow after reconfiguring

After a computer crash I had to reinstall all the necessary tools including python. I reinstalled it by compiling version 3.8 from source because the scripts were based on that. To my surprise and disappointment, I found that while before it took about 90 seconds to complete the job, now the same script, without any changes, takes more than three minutes.
I saw that there is the option --enable-optimizations option while configuring, but reading various comments I got the impression that in the end there was no improvement.
Now the question is how can I get back about the previous execution times? Or is --enable-optimizations the maximum achievable?

FAISS search fails with vague error: "Illegal instruction" or kernel crash

Currently trying to run a basic similarity search via FAISS with reproducible code from that link. However, every time I run the code in the following venues, I have these problems:
Jupyter notebook - kernel crashes
VS Code - receive "Illegal Instruction" message in the terminal with no further documentation
I've got similar code working in Kaggle, so I suppose the problem is with my particular setup.
Based on the print statements, it appears that the error occurs during the call of the .search method. Because of how vague this error is, I've not been able to find much information on the problem. It seems that some people mentioned older processors may have a problem (AVX/AVX2 flags being the culprit?), though admittedly I didn't quite understand the connections.
Problem: Can I get some help understanding this error, and if possible, a potential solution?
Current setup:
WSL2
VSCODE (v. 1.49.0)
Jupyter-client (v. 6.1.7)
Jupyter-core (v. 4.6.3)
FAISS-cpu (v. 1.6.3)
Numpy (v. 1.19.2)
Older machine (AMD FX-8350 with 16GB RAM)
For anyone that runs across this error, the problem (in my case) was that my CPU was old enough that it doesn't support AVX2. To determine this, I used this SO post.
Once I ran the code in Colab or on a newer machine, all was well.

Python program in command line or .exe gives a MemoryError, however works fine in Spyder IDE

Version: Python 3.7 (Spyder) -- OS: Windows10 -- System: Core i5 (6th gen) + 16gb RAM
I wrote a program which handles a lot of data. The following structure is used to accomplish this:
Program Description
A GUI interface is used as a main function (class). In here an interface pops up, asks the user for input, uses this input the make all kinds of calculation, which are specified in different functions.
The first function is an import function, where in a specified (by user) folder is searched for all .wav files and where the data of these are imported. All imported items are appended (numpy.append) to one big array.
The big array (for 20 files about 2.000.000.000 datapoints) is used to calculated characteristics of the sound file. The reason it has so many datapoints is because the samplerate of the .wav file is set on 78125 samples/s, which I need for accurate calculations.
After the calculations, 2 plots are generated in a specified folder and 2 csv's are also stored in that folder with the requested data.
Problem Statement
Running the main function (program) in the spyder environment, works totally fine. It take about 10 minutes to go through all the data and generates the output.
Compiling the function to an .exe using PyInstaller, works fine, no errors, everything dependency imported. However when running the program a MemoryError pops up almost immediatly (see image below).
Image: error message from command line when executing the exe file
Tried solutions
Running the python script via CLI, gives the same error
Running the .exe program with only 2 files to import, works all file, but incredibly slow (much slower than executed via spyder)
Questions
Why has spyder enough memory to process all data with no problems, but when executing the .py via command line or when executing the .exe file, there is always a memory error?
Why does the .exe or the .py via CL run slower than in the spyder IDE?
Goal
This program should be able to process noise data on every laptop in the company (also 8gb ram sometimes). So I want to find a way to let the program allocate all available RAM on the used machine.
Thanks in advance, for any help!
Meanwhile I have found the answer to my question thanks to Axe319:
The Spyder IDE was running on a 64bit version of python, making the program run smoothly and without any issues. Nevertheless my python interpreter was still a 32bit version of python.
Steps taken to solve the problem:
uninstall python 32bit version
install python 64bit version
install all used packages again using pip install -packages-
install PyInstaller again using pip install pyinstaller
Compile the program to .exe using PyInstaller
After this all seems to be working!

Basic Install Cygwin Windows 10 - IO Error opening <file>

I am using Windows 10.
I downloaded setup-x86_64.exe from https://cygwin.com/install.html and am selecting the defaults (Install from Internet/Direct Connection/default locations).
I have tried several mirrors including cygwin.mirror.constant.com
I am accepting all the default packages plus some basic developer stuff (gdb, make) and check "Select required packages (RECOMMENDED)".
I get quite a way through the Cygwin Setup and then get the first of many pop-up messages "IO Error Opening file....._autorebase/binutils/cygwin/grep/mintty etc. Do you want to skip this package?"
If I skip the packages, I get a non-working Cygwin install (it can't find mintty). If I don't skip the packages, it hangs when the Cygwin installer hangs when it gets to the first of the problem packages.
Thanks in advance about what part of the setup process I am missing.
A bit late, but anyway: I have stumbled across the same problems yesterday when I tried to install Cygwin on Windows 10 the first time.
I have followed all advice given at various sites (including this one): Disabled antivirus software, followed the Cygwin FAQ, and so on, but to no avail.
Then I studied the setup log and found a line which told something about an address mismatch (sorry that I don't have the exact wording - I surely won't repeat the experiment ...). That lead me to the idea that it might something have to do with ASLR (a technique for hardening the system against malware).
The next step was to turn off ASLR via the UI of Windows Defender. After I had done that, I could install Cygwin without any problems. I have not yet tested if I actually could use Cygwin when I turn on ASLR again; I don't feel very comfortable when having turned it off completely.
The alternative would be to turn off ASLR per executable. This is also possible in Windows Defender's UI. But it could mean adding dozens of exceptions, depending on how many Cygwin packages you have installed.
The technical reason for the problem is how POSIX's fork() works. Basically, it clones the parent process's image, using the same offset addresses. But when ASLR is active, those offsets will change when cloning the process, which will make fork() fail. Since fork() is extensively used by Cygwin, it can't operate as intended when ASLR is active.

Why does cygwin rebaseall run like a dog?

If you install cygwin these days it runs "rebaseall" as part of its post installation process. This is apparently to realign dlls in some way so that you don't get errors in fork().
At this point in the process the install looks like it has hung for me, both with 32bit and 64bit cygwin. However, if I wait long enough (say 3 hours) the install will finish. At this point the computer runs like a dog - any new process takes forever to start and I have to reboot. If I do this then all is then fine until I try and install something else at which point the whole process kicks off again.
The install is doing something weird to my computer. I have tried closing all applications, removing software - all yield the same result. I have heard others complaining about this but seen no answers other than it must be some thirdy party software. To me this looks like a bug in cygwin.
Incidentally while the install hang is going on I can see dash processes starting and stopping in task manager - so something is happening but really slowly.
Any ideas?
I'll answer my own question. The issue was Trusteer Rapport. This piece of software beloved by banks, causes all sorts of bad side effects including this one.
This is not a programming question.
It is also borderline on http://superuser.com.
A normal update postinstall autorebase step take few minutes. Likely you have some software interfering like an antivirus.
Further reading:
https://cygwin.com/problems.html
https://cygwin.com/faq/faq.html#faq.using.bloda
and ask support on the cygwin mailing list
https://cygwin.com/lists.html

Resources