Questions tagged [python-3.11]

Python 3.11 is the newest release of the Python language. Please use the [python] tag for general Python related questions.

Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation.

References

308 questions
22
votes
2 answers

Python 3.11 worse optimized than 3.10?

I run this simple loop with Python 3.10.7 and 3.11.0 on Windows 10. import time a = 'a' start = time.time() for _ in range(1000000): a += 'a' end = time.time() print(a[:5], (end-start) * 1000) The older version executes in 187ms, Python 3.11…
Michael
  • 878
  • 5
  • 17
19
votes
3 answers

Cannot install PyTorch with Python 3.11 (Windows)

I recently upgraded to Python 3.11 and proceeded to install the libraries I typically use for 3.11. I went through my list one by one with pip. When I tried to install PyTorch, I got an error which says: ERROR: Could not find a version that…
El-One
  • 191
  • 1
  • 1
  • 4
15
votes
1 answer

Are Python 3.11 objects as light as slots?

After Mark Shannon's optimisation of Python objects, is a plain object different from an object with slots? I understand that after this optimisation in a normal use case, objects have no dictionary. Have the new Python objects made the use of slots…
Jorge Luis
  • 813
  • 6
  • 21
13
votes
2 answers

Debugger Warning from ipython: Frozen Modules [python 3.11]

I created a new environment using conda and wanted to add it to jupyter-lab. I got a warning about frozen modules? (shown below) ipython kernel install --user --name=testi2 0.00s - Debugger warning: It seems that frozen modules are being used,…
Elijah
  • 133
  • 1
  • 7
10
votes
4 answers

Tensorflow support for Python3.11

I have Python3.11.0 on a Windows10 PC. Trying to install tensorflow using: pip install tensorflow gives error. Upon visiting the tensorflow site I realised that it supports only 3.7 - 3.10 Should I downgrade the python version or is any workaround…
Sam
  • 141
  • 1
  • 2
  • 9
9
votes
3 answers

Unable to read an Excel file using Pandas

I can read an Excel file from pandas as usual: df = pd.read_excel(join("./data", file_name) , sheet_name="Sheet1") I got the following error: ValueError: Value must be either numerical or a string containing a wildcard What I'm doing wrong? I'm…
9
votes
3 answers

How to pick python 3.11 as a conda environment in vs code

I am just start using vscode to write python code. And I am normally using conda as my package and environment tool. I am trying to create a conda environment for python 3.11 in my project directory based on the instruction in the vscode official…
Wenhao Xu
  • 91
  • 1
  • 1
  • 4
7
votes
2 answers

Special case when += for string concatenation is more efficient than =

I have this code using python 3.11: import timeit code_1 = """ initial_string = '' for i in range(10000): initial_string = initial_string + 'x' + 'y' """ code_2 = """ initial_string = '' for i in range(10000): initial_string += 'x' +…
Dorian Turba
  • 3,260
  • 3
  • 23
  • 67
7
votes
1 answer

What does 'show_caches' and 'adaptive' arguments do in `dis.dis` function

Python 3.11 introduces new two parameters to the dis.dis function, show_caches and adaptive. >>> import dis >>> >>> help(dis.dis) Help on function dis in module dis: dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False) …
Abdul Niyas P M
  • 18,035
  • 2
  • 25
  • 46
6
votes
1 answer

sys.getrefcount() returning very large reference counts

In CPython 3.11, the following code returns very large reference counts for some objects. It seems to follow pre-cached objects like integers -5 to 256, but CPython 3.10 does not: Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC…
Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251
6
votes
2 answers

Creating Virtual Environment with Python 3.11 Returns an Error

I got an error when creating virtualenv with Python 3.11 interpreter. I typed this in my terminal python3.11 -m venv env It returned this: Error: Command '['/home/bambang/env/bin/python3.11', '-m', 'ensurepip', '--upgrade', '--default-pip']'…
6
votes
2 answers

How do you update to Python 3.11 in the base environment of Anaconda? Or at least create a new environment with all the base packages?

I am using the latest Anaconda Navigator (for Python 3.9), and I know how to make a new environment with Python 3.11 in Anaconda. However, whenever I create a new environment, there are hardly any packages there. The base has all the packages I need…
Johnn-1231
  • 85
  • 1
  • 1
  • 5
6
votes
1 answer

Why does this specific code run faster in Python 3.11?

I have the following code in a Python file called benchmark.py. source = """ for i in range(1000): a = len(str(i)) """ import timeit print(timeit.timeit(stmt=source, number=100000)) When I tried to run with multiple python versions I am…
Abdul Niyas P M
  • 18,035
  • 2
  • 25
  • 46
5
votes
0 answers

pipenv install throws "Requirement" object has no field "use_pep517"

Upgraded python (using pyenv) to 3.11.4 Upgraded pipenv to 2023.7.23 version. pipenv lock works successfully. However, pipenv install or pipenv sync -d throws errors. File…
KannarKK
  • 1,593
  • 20
  • 35
5
votes
3 answers

How to prevent python3.11 TaskGroup from canceling all the tasks

I just discovered new features of Python 3.11 like ExceptionGroup and TaskGroup and I'm confused with the following TaskGroup behavior: if one or more tasks inside the group fails then all other normal tasks are cancelled and I have no chance to…
Anton M.
  • 185
  • 1
  • 11
1
2 3
20 21