log_score
int64
-1
11
ViewCount
int64
8
6.81M
A_Id
int64
1.99k
72.5M
Available Count
int64
1
18
Question
stringlengths
15
29k
AnswerCount
int64
1
51
Q_Score
int64
0
6.79k
is_accepted
bool
2 classes
Tags
stringlengths
6
94
CreationDate
stringlengths
23
23
Q_Id
int64
1.98k
70M
Title
stringlengths
11
150
Answer
stringlengths
6
11.6k
Score
float64
-1
1.2
Users Score
int64
-36
1.15k
1
2,224
69,002,555
2
I cant activate virtual env in vs code. I tried same code in the cmd console is work but not in the vs code terminal. "D:\python\djangoapp\djangovenv\Scripts\activate.bat" I write this code. I am using windows 10 pro
3
1
true
python,visual-studio-code,virtualenv
2021-08-31T09:05:00.000
68,995,862
how to activate virtual env in vs code?
yeah Its beacuse of terminal vs code was using powershell ı changed with cmd
1.2
0
0
57
69,006,588
1
When I run the py file, I see from the task manager that each python.exe only occupies 500M of memory. How do I increase it? I modified the memory configuration in pycharm64.exe.vmoptions, but this seems to be the memory setting of the IDE, not the memory setting of python.
1
0
false
python,pycharm
2021-08-31T13:52:00.000
68,999,996
In pycharm, how to increase the memory of each py file when it is running?
The support staff of pycharm responded: PyCharm doesn't set a memory limit for Python processes and doesn't have any control over them in this regard.
0
0
-1
115
69,002,016
1
I am on Windows 10, running python 3.8.5 and have tried installing PyPDF2 using pip. I've uninstalled and reinstalled several times using these two commands: "python -m pip install pypdf2" "py -3 -m pip install pypdf2" I did this through Visual Studio code being run as my user, as well as the command prompt run as an administrator. The install goes well but I get the error, "Import 'PyPDF2' could not be resolved." I figure this is due to the file path to the installed package not being included in the PATH system environment variable. So I used "python -m pip show pypdf2" to find the install location: "c:\users*username*\appdata\local\programs\python\python38\lib\site-packages" So I added: "c:\users*username*\appdata\local\programs\python\python38\lib\site-packages\PyPDF2" to my PATH environment variable for both user and system, as well as the PYTHONPATH variable. After such actions I restarted VS Code, which again is using the python 3.8.5 environment, and still the import could not be resolved. What am I missing? Any assistance would be greatly appreciated.
1
0
false
python
2021-08-31T15:58:00.000
69,001,904
Trouble importing python packages Visual Studio Code
I am using python 3.9.6. But when I typed like this in command prompt, "pip install pypdf2" it worked for me. Try like this sometimes it'll work.
-0.197375
-1
0
37
69,005,723
1
Hello i want to run a specific script by for example typing "run" will run the script. i found some people talking about envoirment vars but i dont know what to do can anyone help me?
1
0
false
python,command
2021-08-31T21:10:00.000
69,005,332
How to execute a python script with a custom command?
I guess you could do alias python="run"
0
0
0
252
69,019,307
1
During installation process (Windows OS) I have 2 options: Add Miniconda to my PATH environment variable Register Miniconda as my default Python The first option is pretty obvious. I understand it completely. But what about the second? What is meant by the word "register"? It creates the file with the string "Ok I have registered your Python"or what? What specific operations will be performed? It's so confusing. I have read the whole documentation on their site, but I couldn't find anything about this.
1
3
false
python,windows,installation,anaconda,miniconda
2021-09-01T18:52:00.000
69,019,206
What it means - "Register Anaconda as my default Python"?
When you do python file.pyin a shell, windows will use the base version(not miniconda) but when you click it, it will use the miniconda's python. Should you do it? That is up to you, however Anaconda recommend's to check it
0
0
0
47
69,039,550
1
I tried to use pyinstaller to compile a .py I wrote. I used a bunch of libraries including sklearn, nltk, gensim but did not use tensorflow at all. However, when I compiled the program, there were many warnings about tensorflow modules not found, such as: WARNING: Hidden import "tensorflow._api.v2.compat.v1.estimator" not found! Is it because other libraries somehow used tensorflow in their functions? Is there a way to find what the usage is? Thanks!
1
1
false
python,tensorflow,pyinstaller
2021-09-01T23:29:00.000
69,021,547
Pyinstaller hidden import not found for unused library
Gensim uses tensorflow. You can add --hidden-import="tensorflow._api.v2.compat.v1.estimator" with your pyinstaller command and it will resolve this error.
0
0
0
26
69,024,600
1
pip install packagename.whl is not working in linux Can you please suggest me something for installation of python packages in linux with no internet connection.
1
0
false
python,package,requirements.txt
2021-09-02T05:08:00.000
69,024,440
Installing python packages in linux which doesn't have network connection using windows
I am going to assume you have some device that has a network connection, so probably download the libraries onto some kind of medium, sd card, usb drive, and then build them on the board using the build instructions, usually in the readme or something. You will have to be careful, since you wont be using pip, to check the version of python you have and download the corresponding/compatible version of the library.
0
0
0
110
69,033,891
1
I have ran a python script in Power Bi but now I want to open the script again and edit it. Is there a way to open the script in PowerBI rather than copying and pasting the whole script from Jupyter notebook? I can't seem to find a way to do so. Cheers!
1
0
false
python,powerbi,script
2021-09-02T06:22:00.000
69,025,084
Edit python script in Power Bi
In Options - Global - Python scripting you can set your Python IDE or any editor you like using the second dropdown menu.
0
0
1
357
69,034,288
1
I am trying to import win32com.client but vscode shows that it couldnt find the module. Import "win32com.client" could not be resolved I have opened VScode in a virtual environment using anaconda. I have installed pywin32 through conda and the vscode terminal as well and the same message was shown. Requirement already satisfied: pywin32 in f:\anaconda\envs\deeplearning\lib\site-packages (228) I have gone through all the posts with the same error and their problem seems to have been solved by just installing pywin32. Could anyone help me with this?
1
0
true
python,visual-studio-code,anaconda,pywin32
2021-09-02T09:31:00.000
69,027,638
Unable to import win32com.client despite having installed pywin32 in VSCode
The problem lied with vscode not actually being in the virtual environment. Click on the python version shown on the status bar at bottom left of the screen and select the venv you want to fix the error.
1.2
0
0
319
69,038,479
1
I have 3.8.8 Python and 4.10.3 Anaconda Spyder, and I use the 2019 MacBook Pro (16 inches screen). When I text in the text editor in Spyder, my text is constantly lagging. The faster I type, the more lags there are. When I delete texts, the faster I press the delete button, the more lags there are. However, this only happens if I maximizes the Spyder window. The smaller the window gets, the less lagging there are. When the window is small enough (such that it takes up only 1/4 of the 16 inches screen), the lagging problem disappears. Other coding interfaces don't have the lagging issue, regardless of the window size. For example, Visual Studio Code doens't have the issue. My presciption is super high (like 12) so I need to use super big screens to work. I don't want to only use 1/4 of the screen and I don't like the lagging either. Can someone help me with this?
1
3
false
python,anaconda,spyder,text-editor,lag
2021-09-02T23:20:00.000
69,037,949
Text Editor in Python Spyder in Anaconda constantly lagging
Personally this sounds like a hardware issue, otherwise try to keep a low usage on ram, and CPU. I would maybe see if there are also communication errors, I can’t help with that as I don’t use MacOS, larger screens do also cause more lag if possible choose dark them so the pixels don’t take up too much power (I think) I had the same issue
0
0
0
173
69,042,682
1
At work we have a Windows machine with a lot of power. It runs different programs, software etc., but as a Python user I would also like to be able to run scripts, write code etc. on that machine as well to take advantage of the power. As of now we have gotten Python installed. The issue arises when I log onto the server with my account, then when I do a e.g. pip install numpy it installs this package on my account/user folder. So basically that means that every person logging in needs to download every package from the beginning if they want to use it etc. Somewhat not what we want to do. So my question is: How do we enable global installation from all users via pip ?
1
0
false
python,pip
2021-09-03T09:24:00.000
69,042,570
pip install multiple users on shared server
Maybe install python to the machine instead of installing it for a specific user? In "Customize installation->Next": Select install for all users when installing python. Create a public package installation folder, like "C:\Users\Public\site-packages" Add or set public installation folder to environment variable PYTHONPATH and PYTHONUSERBASE Execute pip config set global.target [YOUR PUBLIC FOLDER] in command line. Then pip will install package to the public folder and also python could find it by PYTHONPATH and PYTHONUSERBASE.
0
0
0
62
69,044,066
2
I started learning python using Jupyter and have used it since to install packages and import them. However recently I installed PyCharm and am not able to import any of the installed packages. Within Jupyter no matter how much I try the version of python does not update beyond 3.8. With respect to Path variables I've added python 3.9 into the path variable. How do I use the previously installed libraries with other IDEs such as PyCharm and SublimeText? Thank you in advance
2
0
false
python,import,pip,path,ide
2021-09-03T10:58:00.000
69,043,840
How do I use python packages I've already installed in other IDEs
in pycharm after you install module by using pip.You should install the module from library of pycharm also because sometimes pycharm doesn't add that module to project file so you should follow: on the left top of screen in pycharm File>>Settings>>Project:FİLENAME>>Python interpreter >> '+' button on the left bottom corner >> search the module you want >> install it >> then ready to go
0
0
0
62
69,043,967
2
I started learning python using Jupyter and have used it since to install packages and import them. However recently I installed PyCharm and am not able to import any of the installed packages. Within Jupyter no matter how much I try the version of python does not update beyond 3.8. With respect to Path variables I've added python 3.9 into the path variable. How do I use the previously installed libraries with other IDEs such as PyCharm and SublimeText? Thank you in advance
2
0
false
python,import,pip,path,ide
2021-09-03T10:58:00.000
69,043,840
How do I use python packages I've already installed in other IDEs
You have to re-install it in this new ide. Each ide is a virtual environment, so installing a module in that ide only installs it for that ide. That is the main point of environments, you can install the same packages but different versions in each environment. However one downfall is you need to install the package several times.
0
0
1
389
69,045,972
1
I'm learning Python and trying to build code where the for loop checks if a string is empty or non-numeric before it proceeds to add everything. How do I prevent it from going there and instead instruct it to loop through b to e?
3
0
false
python,loops,for-loop
2021-09-03T13:38:00.000
69,045,881
Python for loop won't check each string if it is empty
There are several mistakes in your code: Have you realized that a, b, c, d, e do not exist inside your function? you're working with a list now, not with the individual variables that only exist outside your function! Accumulate the result of the sum in a variable instead, and print it outside the loop. To compare a value against None use is, not ==. The validation for checking if there are duplicates should be done outside the loop. You must not return on each condition! wait until the loop is over before returning.
0.066568
1
2
56
69,091,012
2
So I am trying to install and import pynput in VSCode but its showing me an error every time I try to do it. I used VSCode's in-built terminal to install it using pip and typed the following : pip install pynput but this error is shown : Fatal error in launcher: Unable to create process using '"c:\users\vicks\appdata\local\programs\python\python38-32\python.exe" "C:\Users\vicks\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe" install pynput': The system cannot find the file specified After receiving the following error, I tried using CMD to install it but the same error is shown. I also tried using python pip install pynput and it shows Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. even though I have python 3.9.7 and I have selected it as my interpreter in VSCode and I have IDLE(Python 64 bit) installed. How may I resolve the following error? Any help regarding the same is appreciated Thanks in advance :)
2
0
true
python,visual-studio-code,pip
2021-09-03T13:46:00.000
69,045,992
Error occurring while installing and importing pynput
There's no such thing as an in-built terminal in VS code. When you open a terminal in VS Code, it opens the default, which on Windows is usually equivalent to opening up CMD. If you selected Python 3.9.7 as your default interpreter in VS Code, it does not mean that it will visible to your CMD / terminal. It just means that the VS Code IDE will refer to that instance of Python when launching the program from VS Code itself using the green button (or F5), and when scanning your code to point out missing packages, etc. CMD will only automatically detect your Python if it's in your PATH environment variable. You should add the Python 3.9.7 base and Scripts path to this. Also, it would be best if you could first uninstall conflicting versions (like your 3.8.x) of Python and remove them from PATH, assuming that this won't cause any problems for you. Perhaps keep a record all the installed packages in this old version of Python for future reference using pip freeze or pip list.
1.2
1
1
56
69,047,319
2
So I am trying to install and import pynput in VSCode but its showing me an error every time I try to do it. I used VSCode's in-built terminal to install it using pip and typed the following : pip install pynput but this error is shown : Fatal error in launcher: Unable to create process using '"c:\users\vicks\appdata\local\programs\python\python38-32\python.exe" "C:\Users\vicks\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe" install pynput': The system cannot find the file specified After receiving the following error, I tried using CMD to install it but the same error is shown. I also tried using python pip install pynput and it shows Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. even though I have python 3.9.7 and I have selected it as my interpreter in VSCode and I have IDLE(Python 64 bit) installed. How may I resolve the following error? Any help regarding the same is appreciated Thanks in advance :)
2
0
false
python,visual-studio-code,pip
2021-09-03T13:46:00.000
69,045,992
Error occurring while installing and importing pynput
Check if c:\users\vicks\appdata\local\programs\python\python38-32\python.exe exists by typing cd c:\users\vicks\appdata\local\programs\python\python38-32
0.099668
1
1
47
69,051,922
2
Edit: I am self taught, I don't know the right terms. This question is probably a duplicate but I am not able to find it. I need to include a python pip package in my application say numpy. I don't want the user to pip install -r requirements.txt I want to include the module when the user downloads the application.
3
0
false
python,pip
2021-09-04T01:56:00.000
69,051,899
Include a PIP module in my project so that user doesn't have to download it
you don't have to include pip when you build the app, because when you build the app, all depencies will be included in the app resources, i am not sure which app you are building, but in general, all depencies will be converted to pyc packages when building the app and compiled
0.066568
1
1
47
69,051,925
2
Edit: I am self taught, I don't know the right terms. This question is probably a duplicate but I am not able to find it. I need to include a python pip package in my application say numpy. I don't want the user to pip install -r requirements.txt I want to include the module when the user downloads the application.
3
0
false
python,pip
2021-09-04T01:56:00.000
69,051,899
Include a PIP module in my project so that user doesn't have to download it
It's a whole world to explore, honestly ) you need to explore the subjects of deployment and distribution; those will depend on target operating systems... I would suggest investigating Docker, which allows you to package the OS (some Unix), runtime and dependencies into one "thing".
0.066568
1
-1
106
69,062,399
2
I'm sorry that this has already been asked, but I have not found anything helpful. I am trying to create a discord bot and am following YouTube videos. When I try to run my code, I keep getting the error: ModuleNotFoundError: No module named 'discord' despite having installed discord and discord.py. I checked where it has been asked before and some people have said that using older Python versions makes it work, but newer ones don't. Why not? How can I use an older Python version without ruining the latest one? Thank you in advance.
2
0
false
python,discord
2021-09-04T20:49:00.000
69,058,866
ModuleNotFoundError: No module named 'discord' / how to switch python versions
Did you tried pip install discord and pip install discord.py?
-0.099668
-1
0
106
69,062,447
2
I'm sorry that this has already been asked, but I have not found anything helpful. I am trying to create a discord bot and am following YouTube videos. When I try to run my code, I keep getting the error: ModuleNotFoundError: No module named 'discord' despite having installed discord and discord.py. I checked where it has been asked before and some people have said that using older Python versions makes it work, but newer ones don't. Why not? How can I use an older Python version without ruining the latest one? Thank you in advance.
2
0
false
python,discord
2021-09-04T20:49:00.000
69,058,866
ModuleNotFoundError: No module named 'discord' / how to switch python versions
this happened to me and none of my modules worked. uninstall python and then reinstall it; so that it is updated.
0
0
0
426
69,063,442
1
Have been successfully controlling an arduino uno board with python serial libraries on my own computer but would like to use google colaboratory so my grandson can plug and play without having libraries installed on his computer. can serial libraries be imported into the colaboratory notebook env?
1
0
false
python-3.x,pyserial,arduino-uno
2021-09-05T01:48:00.000
69,060,072
Are python serial communications libraries available in the google colaboratory online dev environment?
You can easily install any package in Jupyter notebooks by inserting a bang command such as !pip install pyserial. Unfortunately, this isn't really what you're looking for. Google colabs running remotely from your computer (this is in large part why they're popular as they can use googles beefier hardware). This means you would be installing pyssrial into a server computer that has no local access to your adruino. I would recommend exporting your code as a notebook and getting him set up locally on his computer with the Jupyter environment. Obviously this is not as plug and play as you want. I can't really think of an easy way to get as plug in play as you want with configurable scripts.
0
0
1
81
69,740,240
2
In Jupyter lab suppose I have a variable string_text if I use ctrl+backspace the entire word is deleted is there a way to delete just the text part in the above example so I am just left with string_ It would be a helpful hack. The same happens with ctrl + delete would be helpful If someone can point me to some resource. I am unable to find help or a hack to do this. What happens:- If i have string_test_first_row variable if I use ctrl + backspace the entire variable is deleted. More Explanation: Is it possible? If I press ctrl + backspace I am left with string_test_first_ (just the word after last underscore deleted)
2
0
true
python,jupyter-notebook,data-science,jupyter,jupyter-lab
2021-09-05T08:59:00.000
69,061,951
How should I use control + delete or control + backspace to delete till underscore
using Vim extension solves this problem. vim extension can do many more things than this but needs some effort learning vim.Vim is a great way to be efficient and can help achieve multiple such simple editing problems
1.2
0
0
81
69,072,825
2
In Jupyter lab suppose I have a variable string_text if I use ctrl+backspace the entire word is deleted is there a way to delete just the text part in the above example so I am just left with string_ It would be a helpful hack. The same happens with ctrl + delete would be helpful If someone can point me to some resource. I am unable to find help or a hack to do this. What happens:- If i have string_test_first_row variable if I use ctrl + backspace the entire variable is deleted. More Explanation: Is it possible? If I press ctrl + backspace I am left with string_test_first_ (just the word after last underscore deleted)
2
0
false
python,jupyter-notebook,data-science,jupyter,jupyter-lab
2021-09-05T08:59:00.000
69,061,951
How should I use control + delete or control + backspace to delete till underscore
if I understand you, you are trying to delete the word "text" from string_text so that you will be left with "String_" Try this Highlight the "text" and press delete or use the Backspace.
0
0
1
96
69,090,786
1
There are many ways available on internet telling about how to compile a python code using cython, cx_freeze etc. But does a compiled code can act as dynamically typed language?
1
0
false
python,dynamic,static,computer-science,cx-freeze
2021-09-05T13:32:00.000
69,063,843
Can a compiled python code be called dynamically typed anymore?
If you want to bend words enough, all dynamically typed language simply have values of the type "any", from that view, even uncompiled Python is "statically typed". However, that is not a super-useful view. But, it would depend exactly how the compilation is done. If the compiled code is simply using the PyObject type, it's definitely still dynamically typed. If the compiler does type inference and statically types some values as more restrictive types, it's still dynamically typed (but with some narrowly typed bits). Only at the point where all (or at least essentially all) values have been statically typed to more narrow types could we consider the result as statically typed.
0.197375
1
2
93
69,066,382
1
I am an (old) engineer not a programmer so forgive me for asking a naïve question. My understanding is that to get really fast execution times for a program, it needs to be compiled to native machine code. And there are a relatively small number of languages still in use that do this (e.g. C and C++). But I much prefer the syntax of Python over that of the C-derived compiled languages. However my understanding is that interpreted Python (and pseudo-compiled Python run on a virtual machine) cannot match the execution speed of a truly compiled language. Is there some reason that a true native-code Python compiler cannot be developed? [I am interested specifically in Python but I am not aware of any language that can be interpreted and also compiled to native machine code.]
1
2
false
python,interpreted-language,compiled-language
2021-09-05T18:28:00.000
69,066,194
Why are there no languages that are both interpreted and (really) compiled?
The key distinction is a clean separation between compile time and run time. In Python, for instance, import happens at runtime, and can happen conditionally. And per the halting problem, that means a compiler cannot determine up front if a given import will happen. Yet, this affects the code that would need to be generated. As Bill the Lizard notes, if the language does have a clean distinction, an interpreter can still choose to ignore it. C's #include can happen before main, but that does not mean an interpreter must do so. Outside the syntax, Python is also virtually uncompilable due to weak typing. In C, + has a very limited set of meanings - integer, floating point or pointer, and the compiler will know the static type of the arguments. C++ has far more extensive overloading, but the same basic principle applies. virtual functions allow some run-time flexibility, but from an finite set of options, all compiled before main starts. Also not syntax is the memory model - both C and C++ have a memory model that's an improved derivative of Java's memory model, which makes threading quite efficient. (Unlike Java, not every object can be synchronized, you need special members). As CPU's gain more and more cores, the advantages only continue to grow. Compilers can see pretty well where memory and CPU registers need to be brought in sync.
0.53705
3
1
305
69,075,366
1
This question is regarding the Time Complexity of two algorithms. So I am a solving a question involving two lists (not sorted) of integers, and I want to return the pair of integers (one from each list) with the smallest absolute difference. The naive approach is simply to iterate through both lists, and keep track of the smallest difference throughout, and at the end return the pair that produced this difference- I believe this would take O(mn) time, where n and m are the length of each list; as we simply use 2x for loops. Another approach is to sort both lists, then iterate through both of them, and there is some logic where we can break out of the for loops in many instances without iterating through the whole of the second list. I believe this would take O(nlogn + mlogm) time, again where n,m are the lengths of the two lists. I read on the solution page that solution 2. is more efficient, but I don't see why?- if the time complexity I mentioned above are correct, for solution 2. if we factorise by mn what's left >0??
2
2
false
python,time-complexity
2021-09-06T13:17:00.000
69,075,239
How does the time complexity of iterating through two unsorted list of integers compare to sorting then iterating through the lists?
Let's simplify the equations a bit and let's assume: n = m First case, complexity is: n * m = n^2 Second case, complexity is: n * log(n) + m * log(m) = 2 * n * log(n) For any existing n you have 2*log(n) < n, i.e. the second solution is faster than the first one.
0.099668
1
1
63
69,078,999
1
I don't mind slow computing but lack of memory crashed my computer on some program runs. Will any Python IDLE program be able to access all installed RAM and use it if neccessary?
1
0
false
python,ram,python-idle,channels
2021-09-06T18:23:00.000
69,078,881
Will any python code that run in idle have access to all installed ram?
Oh ... you're mixing a lot of concepts which you haven't fully understood. I'm considering buying a new computer (my old is kaput). If it's broken, you should either have it repaired or buy a new one. it was explained to me how that by default the program run in one thread unless written for more threads. Python programs will run on one thread because of the GIL (global interpreter lock), that's true. If you want more CPUs to be used, you need to use the multiprocessing library. I don't mind slow computing but lack of memory brought some program runs to a hault [sic] I assume that you mean halt. I doubt that this is possible. Programs can become really slow if there's not enough physical RAM, maybe by a factor of 1000. The reason is that RAM will be swapped to disk and that operation takes much longer. But it should not stop completely. "Will for example four dual channel RAMs work with Python programs that run in IDLE?" Is what I've been contemplating. Yes and no. Python does not have direct access to physical RAM. The operating system provides virtual RAM to an application. Typically, if there's no other reason against it, the operating system will give physical RAM. Therefore yes, more physical RAM will typically increase the physical RAM available for Python programs. Will any Python IDLE program be able to access all installed RAM and use it if necessary? No. For example, 32 Bit Python will only be able to address a subset. But even with 64 Bit Python, some memory will be reserved for the operating system. could have been computed and stored in stages To answer that, we would need to know what you are computing and how much memory that will need. Typically, the memory need can be computed. The Big-O notation does that. And typically you can compensate RAM for CPU and vice versa. Is it possible to have enough computing power if there is enough time and drive space? For some tasks, there is never enough computing power, e.g. brute force password cracking. Again, we would need to know what you are attempting to calculate. How to procede? First of all, it would be good to know your PC specs. How many CPU cores and how much RAM do you have? Second, a look at task manager shows how much RAM is in use, cached and free? It's quite likely that CPU is mostly idle (as you said, it's only 1 of maybe 8). It's also quite likely that your RAM is still free. In such a case, your algorithm is just crappy, e.g. stuck in an endless loop. Learn about the difference between physical RAM and virtual RAM. Talk in the correct terms. Learn how to measure both. Then come back with the numbers and the source code. BTW: what is actually kaput with your computer? And how did you diagnose that? If your computer is just not doing what you think it should do, maybe it's simply a bug in the program.
0.197375
1
-1
120
69,150,690
1
Im trying to install QuantLib package. I used brew install quantlib in terminal and it succeed. And I tried import quantlib as ql in VScode but there's No module named quantlib error message came out. Also I tried import QuantLib as ql as well. I don't know how to solve this problem. I tried pip install QuantLib and it didn't work at all in my terminal. I use M1 MacBook Pro. Thank you
1
0
false
python
2021-09-07T04:54:00.000
69,082,561
No module named 'quantlib' in VS Code M1 Mac
if this doesn't work pip install QuantLib try to add this package in pycharm Most of times i also do like this to avvoid these errors. hope it works for you too..:)
-0.197375
-1
2
1,862
69,084,457
1
I'm looking for some sort of naming scheme for my virtual environments. How do you usually name them? Is there naming convention for python virtual environments?
1
0
true
python,virtualenv,naming-conventions,virtual-environment
2021-09-07T06:23:00.000
69,083,256
The naming rules for your virtual environments in python
If you are storing your environment inside the project folder some common names are env, venv, .env, .venv, but besides that, I don't think there are any common conventions.
1.2
1
1
1,274
69,088,550
1
I installed a module by cmd and setup.py. my module is installed on site packege and worked good in python shell. But in spyder , my module is not working and says me no module. Please help me.
1
0
true
python,installation,module,spyder,setuptools
2021-09-07T12:35:00.000
69,088,365
How install a module in spyder
you can select your python interpreter in Tool > Preferences > Python Interpreter > Use the following python Interpreter > (path to python.exe) Make sure to restart your console or spyder.
1.2
0
0
67
69,098,435
1
I have already searched this question on stack overflow, but didn't find something that helped me or simply didn't understand them. What I want is a way to affirm that the user has entered the time in the following format hh:mm-hh:mm. example:13:30-14:30. I don't mind the format being 12hr or 24hr. Also the time needs to be restricted, in the sense that minutes should not go beyond 59 and hours should not go beyond 23. I've seen solutions that make use of regex, and I've seen the official documentation as well, but I find it hard to understand. So if anyone is using regex for an answer I don't mind accepting it as long as the answer explains the meaning of the regex expression. pattern=r'[0-2][0-9]:[0-5][0-9]-[0-2][0-9]:[0-5][0-9]' This was my attempt, but as it is clearly visible this has a lot of bugs. According to this expression,29:58-29:59is a valid time, which of course isn't.
5
0
false
python,regex,datetime,time,python-re
2021-09-08T06:50:00.000
69,098,220
How do I limit the user from entering the wrong format for my time field
Use this pattern (in 24 hour format): /^([0-1][0-9]|2[0-4])\:([0-5][0-9])\-([0-1][0-9]|2[0-3])\:([0-5][0-9])$/g Pattern description: For hour: If the first number is 0 or 1 then second number can be between 0-9 (Like 01, 09, 18 and ...) or if the first number is 2 then second number can be between 0-3 (Like 20, 21, 22 and 23) For Minute: If the first number is between 0-5 the second number can be between 0-9 (Like all minute numbers).
0
0
0
44
69,099,499
1
I was trying to run python code with the "python" command. There was no error message but the program just wasn't executed. For test.py, I merely wrote a print(123), hoping it may print out the number. However, there's no output. Also, command such as python --version didn't work either. I'm using anaconda and I've added it to my path. I've found that if I specify the full path of python.exe, it would work. I'm wondering why? I thought that when python is added to the path, it should be called with the python command.
1
0
false
python,windows
2021-09-08T08:07:00.000
69,099,233
Why the python command does't work even if I've added it to my path?
Make sure Python is properly installed Make sure it is added in PATH properly Try running a .py outside Anaconda
0
0
-1
75
69,105,594
1
I have a file named Document.pdf and sometimes it is called Document-12345678.pdf where -12345678 is a random number. I want to check a file is downloaded in folder. When the file is not finished it display Document.pdf.fkasfmq or Document-12345678.pdf.fkasfmq where .fkasfmq is a random hash from the downloader and I don't want it to match. I try make a regex like r'Document(?:[\-0-9]+).pdf' and test it with either Document.pdf or Document-12345678.pdf it will always return false. From my understanding (?:[\-0-9]+) means it can be or not in the set that matches any hyphen and any numbers before .pdf, is that correct? I am very very rusty with regex...
3
0
false
python,regex
2021-09-08T15:03:00.000
69,105,467
Python regex OR expression
You can just use (\d{8}) to see if there's a document there with 8 digits in the filename.
-0.066568
-1
0
179
69,107,922
1
While writing Python code in PyCharm on Mac I installed some Python Packages not in the virtual Environment but globally. How can I check those installed Packages and delete them?
2
1
false
python,macos
2021-09-08T18:15:00.000
69,107,890
How to uninstall Python packages installed globally on Mac?
You can use pip freeze command to get all your globally installed packages and delete them
0
0
0
653
69,119,644
1
I use Visual Studio Code for all of my programming in Python, and rely heavily on the Interactive Window and Data Viewer. I usually work with large data sets, though this has only marginally affected run times in the past. For some reason recently, when clicking on a data frame in the Interactive Window, a Data Viewer tab will appear but not fully load the data frame. The blue line signaling that it is working just keeps scrolling across the top of the screen interminably. Everything else seems to work fine, and the programs are still able to run, however I can't really continue developing them. Does anyone have any tips for how to make the Data Viewer work again? I have already uninstalled and re-installed Visual Studio Code, and have disabled extensions as well.
1
2
false
python,visual-studio-code,vscode-settings,delay,vscode-extensions
2021-09-08T22:24:00.000
69,110,292
Visual Studio Code Data Viewer Issues
I have solved this by re-installing the Python extension. Thank you!
0
0
3
28
69,113,295
1
I have a long String: s1= "I am asking a question related to python String" and I have a substring: s2 = "related to python String" I am looking for the result "I am asking a question" which is (s1-s2) any efficient way to do it?
1
0
true
python,python-3.x,string,slice
2021-09-09T06:27:00.000
69,113,230
How will I get remaining string from a long_string - Substring_of_log_string in python
You can use .replace(). sliced_string = long_string.replace(short_string, '') Keep in mind it will remove all the occurences of the short_string. Use replace(short_string, '', 1) to remove only one occurence.
1.2
2
0
967
69,113,648
1
My program prompts the user to input the volume of a sphere. This is one of the example input I have to try: 1.4*1.0e6 This is what I have as the prompt right now: volume = float(input("Enter volume of sphere in mm^3: ")) And I got this error: ValueError: could not convert string to float: '1.4*1.0e6' Why is it that when I directly assign the value of a variable like a = 1.4*1.0e6, it's a float but when the user inputs, it's a string? How do I convert it to float? Is there any built-in functions to do that? Sorry for my bad English and thank you.
4
1
false
python,string,math
2021-09-09T07:00:00.000
69,113,601
How to convert string to float in Python? Why is it a float when directly assigned but a string when a user inputs it?
ValueError: could not convert string to float: '1.4*1.0e6' you try to convert formula to float. the most easy way is convert string to formula using eval volume = eval(input("Enter volume of sphere in mm^3: "))
0
0
0
76
69,744,186
1
I am trying to install the Dalle-pytorch, but at every try, the following error appears: [WinError 2] Le fichier spécifié est introuvable: 'c:\python39\Scripts\sacremoses.exe' -> 'c:\python39\Scripts\sacremoses.exe.deleteme'. Can anyone help me solve it?
1
1
false
python
2021-09-09T14:33:00.000
69,120,103
WinError 2 cannot find file: 'c:\\python39\\Scripts\\sacremoses.exe' -> 'c:\\python39\\Scripts\\sacremoses.exe.deleteme'
Try to use pip install sacremoses
0
0
1
104
69,127,701
2
I know that Python is an interpreted language but I want to know the whole execution process. Like how a .py file is executed. For example, a .c file is compiled into a .asm file then the assembler translates it into a '.o' file and finally linker links the object files to form a .exec file. What's the process for python?
2
0
false
python,c
2021-09-10T05:16:00.000
69,127,564
What is the execution process for Python?
After running the script you created (.py), python compiles the bytecode (.pyc) (not a set of instructions for the processor). This bytecode is a set of instructions for PVM (Python Virtual Machine). PVM executes this bytecode. As a result: .py -> .pyc -> PVM execution If the .py file has changed, the system will compile the .pyc again.
0.099668
1
1
104
69,132,233
2
I know that Python is an interpreted language but I want to know the whole execution process. Like how a .py file is executed. For example, a .c file is compiled into a .asm file then the assembler translates it into a '.o' file and finally linker links the object files to form a .exec file. What's the process for python?
2
0
true
python,c
2021-09-10T05:16:00.000
69,127,564
What is the execution process for Python?
The Python interpreter processed the script in a sequential manner. Then the code is compiled into a form of instruction set called the bytecode. Bytecode is a low-level language. It is an intermediate, machine-independent code which optimizes the process of code execution. So, the interpreter ignores the compilation step when executing the code for the next time. After these the interpreter transfers the code for execution. The Python Virtual Machine (PVM) is the ultimate step of the Python interpreter process. It is a part of the Python environment installed in your system. The PVM loads the bytecode in the Python runtime and reads each operation and executes them as indicated. It is the component which actually runs your script
1.2
0
1
97
69,136,356
1
Everytime I deploy my app, I delete all the stuff in the folder and I load my Github app project (with the .spec) before running buildozer -v android release. Now I encounter this error: toolchain.py: error: the following arguments are required: --package but I only changed my python code. How is it possible that changing python stuff makes my .apk creation crash ? What could I try to debug this ?
1
0
true
python,kivy,buildozer
2021-09-10T09:45:00.000
69,130,360
Kivy buildozer: toolchain.py: error: the following arguments are required: --package
Found it, you can begin a line with # to make a commentary but you can't do put it following a useful line.
1.2
0
0
190
69,582,220
1
I clicked "python: select interpreter - enter interpreter path - find" But I can't find that path. How do I find and select interpreter path?
1
0
false
python,visual-studio-code,wsl-2
2021-09-10T09:58:00.000
69,130,525
How do I find the virtualenv path installed via wsl2 when choosing python interpreter in vscode?
You need to point to the python.exe which is under the installation location of the python. If you don't know where the python.exe is, you can find it in the cmd with the command of where python. And of course, you need to add the python installation location to the system environment variable of path first.
0
0
0
70
69,133,868
1
I have jupyter-lab installed via pip3 with Python 3.8.10 on Ubuntu 20.04. I've been using it for months, but noticed some problems getting KeplerGL to render maps in it. While trouble-shooting this, I ran jupyter --version to see which version of jupyterlab I have installed (KeplerGL setup varies based on jupyter-lab version), and mysteriously, it says: jupyter lab : not installed Quite odd, because I have it open right now; I launched it from the command line like this: $ jupyter-lab I ran pip3 install jupyterlab for good measure, and got a bunch of "requirement already satisfied" messages. I suspect this has something to do with my inability to render KeplerGL, but my main purpose for this inquiry is figuring out why Jupyter isn't seeing jupyter-lab.
1
0
false
python-3.x,jupyter,jupyter-lab,kepler.gl
2021-09-10T12:39:00.000
69,132,346
jupyter-lab installed but jupyter doesn't see it
Did you make sure everything is installed in the same environment?
0
0
1
8,101
69,283,409
1
I created a v.environment where I have Python version 3.6.5 and there I installed tensorflow-gpu. The version of TensorFlow is 1.4.0 and of Keras is 2.6.0. When I write on the script import keras it appears the following Error: ImportError: cannot import name 'tf2' Have you any idea?
1
1
false
python,tensorflow,keras
2021-09-10T13:08:00.000
69,132,718
Cannot import name 'tf2'
From comments Here the problem caused by the TF is too old, and the keras is too new. Your choice is to downgrade keras to 2.2.1, or use newer version of tf (paraphrased by Vinson Ciawandy & homomathematicus)
0.197375
1
0
88
69,145,408
1
I was wondering whether running two scripts on a dual-core CPU (in parallel at the same time) decreases the speed of the codes as compared to running them serially (running at different times or on two different CPUs). What factors should be considered into account while trying to answer this question?
2
0
false
python,performance
2021-09-11T17:34:00.000
69,145,314
Does running two scripts in parallel on a dual-core CPU decrease the speed as compared to running them serially?
How Dual Cores Works When Running Scripts running two separate scripts if you run one script then another script on a dual core CPU, then weather or not your scripts will run on each of the cores is dependent on your Operating System. running two separate threads on a dual core CPU then your threads will actually be faster than on a single core.
0
0
1
670
69,149,228
1
I tried to import numpy but I received a ModuleNotFoundError: No module named 'numpy' error. Someone told me it could be because I didn't have numpy installed, but I already did. upon installing numpy I got Requirement already satisfied: numpy in ./opt/anaconda3/lib/python3.8/site-packages. which python returns /Users/MacBook/opt/anaconda3/bin/python. I am new at this, but I'm guessing the reason I got that error was because the files aren't in the same place? If so, how do I move it to the right place? side note: I have a similar issue with matplotlib and this is running on VS code if that helps. Also I use spyder and I don't get the numpy nor the matplotlib error over there, but the error seems to be on VS code
2
0
false
python,numpy,path,anaconda
2021-09-12T05:36:00.000
69,148,743
Python: No module named 'numpy'
Try uninstalling numpy and re-installing. You also try re-install anaconda. I had this same issue and that fixed it.
0.099668
1
-1
87
69,152,397
1
I have python file i want to share it to my friends, but they are saying they cant download the file. Is there any way that they can run the python file without downloading that file? They cant download .exe files also. I tried using online compiler for python but as my file has tkinter and many modules, compilers are not able to run my file.Can i run the code which i have mentioned in google colab or jupyter notebook? Please suggest me how to do this. I just want to demonstrate the app which i created.
2
0
false
python
2021-09-12T13:40:00.000
69,151,951
How to run python file without downloading it?
Ask to run '.py' extension in a Code Editor (eg. VSCode) Or else just ask to run the '.exe' by downloading it. And then delete if not want to keep it.
-0.099668
-1
0
484
69,184,508
1
In Sublime (Windows), we can use some shortcuts likes, Ctrl + Shift + D: Duplicate line Ctrl + Shift + UP: Move line Up Ctrl + Shift + Down: Move line Down I want to know in Python IDLE, are there some keyboard shortcuts for these task? Or can I add these shortcuts by doing something? Any help, thanks.
3
0
false
python,python-idle
2021-09-12T15:44:00.000
69,152,975
Are there keyboard shortcuts for duplicate current line, move line up / down in Python IDLE?
The standard way to duplicate a slice of text is to select it, copy it, and paste it one or more times wherever one wants. Move the cursor with either key or mouse. To easily select complete lines, including carriage returns, turn on line numbers on the Options submenu. Then click on a line number to select one line or click and drag to select multiple lines. To move instead of duplicate, cut instead of copy.
0
0
1
33
69,628,058
1
I'm using inspect.stack()[1].function to fetch the name of the function but I'm getting the value __protected_call_. The function is decorated as a Celery task. How to get the actual func name?
1
0
true
python,python-3.x
2021-09-13T02:32:00.000
69,156,656
Getting __protected_call__ in inspect function
inspect.stack()[0].function returns the actual function throwing the error.
1.2
0
0
44
69,165,224
2
I am a beginner in Python and PyCharm. I had installed both Python and PyCharm in my D drive, instead of C. But then, I was facing some issues, so had to uninstall and reinstall them in my C drive. Now, when I use the pip command in CMD, it says Fatal error in launcher: Unable to create process using '"D:\Program Files\Python\python.exe" "C:\Users\USERNAME\AppData\Local\Programs\Python\Python39\Scripts\pip.exe" ': The system cannot find the file specified. I tried looking for solutions but have given up. Does anyone have any suggestions?
3
0
false
python,pip,pycharm,drive
2021-09-13T15:12:00.000
69,165,133
Problem with installing Python in external drive
I also had the same problem and I tried the following steps: Open CMD as an administrator. Write 'python -m pip install -U --force pip' in the CMD. Restart your PC/laptop. Try the pip command now.
0
0
1
44
69,165,241
2
I am a beginner in Python and PyCharm. I had installed both Python and PyCharm in my D drive, instead of C. But then, I was facing some issues, so had to uninstall and reinstall them in my C drive. Now, when I use the pip command in CMD, it says Fatal error in launcher: Unable to create process using '"D:\Program Files\Python\python.exe" "C:\Users\USERNAME\AppData\Local\Programs\Python\Python39\Scripts\pip.exe" ': The system cannot find the file specified. I tried looking for solutions but have given up. Does anyone have any suggestions?
3
0
true
python,pip,pycharm,drive
2021-09-13T15:12:00.000
69,165,133
Problem with installing Python in external drive
This is because your path file is still leading to the pip in D: Go to path and change that to your C: directory for pip
1.2
0
0
36
69,170,118
1
I get a file not found error while using the read_csv() function on a Jupyter notebook even when I have the exact path listed. Any pointers on why this happens? Googled it and one solution was to prefix the path with 'r' which worked. However why is this prefix required?
1
0
false
python,jupyter
2021-09-13T23:21:00.000
69,170,070
file not found error while using read_csv on a Jupyter notebook
This is raw strings event. It is necessary on Windows operating systems when the path contains backslashes. Otherwise the backslash is treated as an escape character. For example, "hello\nworld" -- the \n means a newline. r"hello\nworld" literally means the characters "hello\nworld" And in this way we can see in the screen hello world
0
0
0
985
69,171,966
1
In my code I have: '''import pygame''' When I run: ModuleNotFoundError: No module named 'pygame' When I pip install pygame (also tried pip3 install pygame and pip3.7 install pygame): Requirement already satisfied: pygame in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2.0.1) Really lost here any help appreciated. python --version = Python 3.7.4 pip --version = pip 21.2.4 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
1
0
false
python,pygame
2021-09-14T03:00:00.000
69,171,299
Module Not Found, but Requirement already satisfied
While getting such error even after installing the required module, check for the following: The python environment/ installation used by your IDE should be same as the environment where the module is installed. Else, change the environment to the Python environment paste the path to python.exe inside bin folder of your environment And install the package again. Specific for VS Code Click on python followed by version number or venvin the bottom ribbon of the editor and add the path to interpreter or choose an existing interpreter you want to use.
0
0
3
75
69,186,357
1
I was tasked with implementing an HFSM with parallel states and the ability to transition to multiple parallel states in Python. Unfortunately, I could not find a library that supported this. I was told to look into Camunda. I am having trouble understanding how parallel HFSM relates to Camunda? Is there any way to implement parallel HFSM in Camunda?
1
2
true
python,workflow,bpmn,camunda,fsm
2021-09-14T09:01:00.000
69,174,880
from HFSM with parallel states to Camunda?
A process engine is a state machine. The process model defines the possible states (events and tasks) and allowed transitions (sequence flows). The token flow represents the state of an instance of this model. There is a concept of sub processes and parallel states/execution/multiple tokens can be achieved by using parallel gateways, inclusive gateways, and non-interrupting events. You also have multi-version enactment at runtime. Camunda would nicely cover the requirement and would do so with the ability to configure the models in a graphical, business-friendly fashion (BPMN2). However, there wouldn't be anything left to implement for you. Maybe some task worker in python. If this is an academic exercise, then the idea is probably not to make an already implemented state machine work, but to roll your own. As you do so, you will find reasons why you would not want to program your own for real-world use cases, how much easier it is to use an existing product, and how much work has gone into various features that are time-consuming to implement yourself.
1.2
2
0
41
69,180,527
2
I have installed python 3.9 in Ubuntu, because it comes with python 3.8 which is an older version. I changed the command for terminal alias python 3 = python 3.9, but when I installed pip, it installed for python 3.8 and after that when I am using pip install to install python packages, it installs for python 3.8. How can I fix it?
2
0
false
python,ubuntu
2021-09-14T10:24:00.000
69,176,058
Python pip installing problem in ubuntu libux
Due to variations in the installation process of python, pip often requires different ways to access for different people. A few examples that may help you include pip3 install, py pip install py -3 pip install or python3 pip install. Usually one of these works for me.
0
0
0
41
69,176,142
2
I have installed python 3.9 in Ubuntu, because it comes with python 3.8 which is an older version. I changed the command for terminal alias python 3 = python 3.9, but when I installed pip, it installed for python 3.8 and after that when I am using pip install to install python packages, it installs for python 3.8. How can I fix it?
2
0
false
python,ubuntu
2021-09-14T10:24:00.000
69,176,058
Python pip installing problem in ubuntu libux
try with pip3 install This kind of issue even happened to my case when I was working with the python modules recently on my project. Try this out it worked for me.
0
0
1
70
69,186,166
1
I have a matrix of matrices that I need to do computations on (i.e. a x by y by z by z matrix, I need to perform a computation on each of the z by z matrices, so x*y total operations). Currently, I am looping over the first two dimensions of the matrix and performing the computation, but they are entirely independent. Is there a way I can compute these in parallel, without knowing in advance how many such matrices there will be (i.e. x and y unknown).
3
0
false
python,parallel-processing
2021-09-15T00:59:00.000
69,185,976
Python for loop multiprocessing
An alternative to the multiprocessing pool approach proposed by other answers - if you have a GPU available possibly the most straightforward approach would be to use a tensor algebra package taking advantage of it, such as cupy or torch. You could also get some more speedup by jit-compiling your code (for cpu) with cython or numba (and then for gpu programming there's also numba.cuda which however requires some background to use).
0.066568
1
0
44
69,193,318
1
I've installed the latest python version 3.9.7 on my ubuntu 20.04 machine. I'm attempting to run some code that requires the Talos package, however I've attempted several times to install Talos using pip3. It does much of the work downloading and installing stuff, until it gets to something called "building wheel for scipy", and then after a lot of work, all I get is error messages. My first question is, is it possible that there is no version of Talos for 3.9.7, or that 3.9.7 is too advanced? If it should integrate Talos, how can I diagnose the problem so I can get it installed? Thx. J
1
0
false
python,scipy,tensorflow2.0,talos
2021-09-15T11:32:00.000
69,192,327
Can not get python to install Talos package
This could be because the wrong version of Cython is being picked up. I have experienced this being the cause of scipy build errors in the past. I would try a pip3 install --upgrade cython first.
0
0
1
114
69,204,705
1
Suppose the Python package mypackage is at a non-standard location on my machine and I am running Python code in the VSCode interactive window. If I type import mypackage it will not be found. This can be remedied by doing sys.path.append("/path/to/mypackage"). However, I would like to set things up so that within a given project each time I open the interactive window a set of paths, like /path/to/mypackage, have already been added to the search path. Is there a way to do this?
1
0
true
python,visual-studio-code
2021-09-15T12:01:00.000
69,192,732
Default Python paths when using VSCode interactive window
You can do this to modify the PYTHONPATH: Add these in the settings.json file to Modify the PYTHONPATH in the terminal: "terminal.integrated.env.windows": { "PYTHONPATH": "xxx/site-packages" } Create a .env file under your workspace, and add these settings in it to modify the PYTHONPATH for the extension and debugger: PYTHONPATH=xxx/site-packages You can refer to [here][1] to understand the effects of these two configurations.
1.2
0
0
91
69,203,606
1
I can install, uninstall and upgrade prettytable using pip [un]install [-U] prettytable. But running the mbed-tools compile command keeps on reporting "ModuleNotFoundError: No module named 'prettytable'" I can see the package is added to my ...\appdata\local\programs\python\python39\Lib\site-packages\ folder. According to my environmental path the folder ...\appdata\local\programs\python\python39\Scripts\ is added and many packages has en .exe file installed there, but prettytabe is missing. Could this be the problem? If so, how do I install it and ensure that it actually has en exe install too? I'm running python 3.9.7 on pretty-much-the-latest Windows 10.
1
0
false
python,installation,pip,mbed,prettytable
2021-09-15T13:33:00.000
69,194,199
How to fix prettytable installation
So it turned out I had Python 3.8.7 installed together with Python 3.9.7. So uninstalling the older one solved the problem...
0
0
2
73
69,198,457
1
I had to format my laptop and python was installed, but there is something different now, before formatting when I open CMD and type python it runs without anything else, but now I have to change the directory to run python (cd C:\Users\Khaled\Desktop\python) to run, what can I do to run python without changing directory??
1
0
true
python,cmd
2021-09-15T18:43:00.000
69,198,344
python not working in cmd until path given
Install python in C: drive then set Environment Variable by Right click on My COMPUTER icon then select properties then got Advance system Setting if Window PC then select Environment Variable and give path of your Python where you installed for example if in C Drive C:\python39\Scripts;C:\python39 python39 is my folder name of python installed directory which is in C drive set user and sysem variable by click on edit option
1.2
1
0
68
69,200,671
1
I am trying to install the library for face_recognition. I keep getting the error "ERROR: CMake must be installed to build dlib" I've already installed CMake and dlib, and when I try and re-install it using pip I get a confirmation they are already installed. I also tried adding the library through the setting in PyCharm (where I can see both CMake and dlib are installed) and is still gives an error. Does anyone know what I am missing?
1
0
false
python,python-3.x,cmake,window,face-recognition
2021-09-15T19:39:00.000
69,198,914
Python face_recognition won't install
Try to do RUN apt-get update && apt-get install -y cmake before the pip install.
0
0
1
23
69,199,597
2
I am learning python from online channels and I came across a question in Instagram. I need help in understanding why the output of the below code is 111111 as '1' is a string and 2 and 3 are ints. any help is appreciated. Thanks. code - print('1'*2*3) Output - 111111
2
0
false
python
2021-09-15T20:44:00.000
69,199,576
Need help in understanding code output please
The code: print('1'*2*3) is the same as: print('1' * 6) which means repeat the string '1' six times as a single string.
0.099668
1
3
23
69,199,612
2
I am learning python from online channels and I came across a question in Instagram. I need help in understanding why the output of the below code is 111111 as '1' is a string and 2 and 3 are ints. any help is appreciated. Thanks. code - print('1'*2*3) Output - 111111
2
0
true
python
2021-09-15T20:44:00.000
69,199,576
Need help in understanding code output please
* between a string and an int repeats the string that number of times. So '1'*2 repeat the string '1' twice, producing '11'. Then you evaluate '11' * 3 and repeat '11' thrice, producing the end result of '111111'.
1.2
2
2
61
69,201,740
1
The first time I have installed Python on my machine, it was Spyder with Anaconda. But, with this version, I wasn't able to install pyodbc. So, I have install Visual Studio Code and everything works fine But today, I have tried to update some libraries (like certify or scipy) but each time I use pip install, I update my Anaconda folder and not my WindowsApps folder. So, when I use PIP, how to update the Windows folder and not Anaconda. And also how to remove Anaconda from my computer. In my Windows Settings, I have no app related to Anaconda (weird)
2
0
true
python,visual-studio-code,pip,anaconda
2021-09-16T02:26:00.000
69,201,680
Pip update the wrong python folder
Check your path, and which pip executable is being executed. If you run it with the full path to your install in WindowsApps, then it should detect and update that version.
1.2
1
1
36
69,208,106
1
While it is possible to simply use pip freeze to get the current environment, it is not suitable to require an environment as bleeding edge as what I am used too. Moreover, some developer tooling are only available on recent version of packages (think type annotations), but not needed for users. My target users may want to use my package on slowly upgrading machines, and I want to get my requirements as low as possible. For example, I cannot require better than Python 3.6 (and even then I think some users may be unable to use the package). Similarly, I want to avoid requiring the last Numpy or Matplotlib versions. Is there a (semi-)automatic way of determining the oldest compatible version of each dependency? Alternatively, I can manually try to build a conda environment with old packages, but I would have to try pretty randomly. Unfortunately, I inherited a medium-sized codebase (~10KLoC) with no automated test yet (I plan on making some, but it takes some time, and it sadly cannot be my priority). The requirements were not properly defined either so that I don't know what it has been run with two years ago.
1
0
false
python,dependencies,backwards-compatibility,python-packaging,developer-tools
2021-09-16T07:52:00.000
69,204,415
As a python package maintainer, how can I determine lowest working requirements
Because semantic versionning is not always honored (and because it may be difficult from a developper standpoint to determine what is a minor or major change exactly for each possible user), and because only a human can parse release notes to understand what has changed, there is no simple solution. My technical approach would be to create a virtual environment with a known working combination of Python and libraries versions. From there, downgrade one version by one version, one lib at a time, verifying that it still works fine (may be difficult if it is manual and/or long to check). My social solution would be to timebox the technical approach to take no more than a few hours. Then settle for what you have reached. Indicate in the README that lib requirements may be overblown and that help is welcome. Without fast automated tests in which you are confident, there is no way to automate the exploration of the N-space (each library is a dimension) to find a some minimums.
0.197375
1
0
209
69,206,229
1
I have a very long python code to run and when I ran it in the morning, my system ran out of memory space. I believe this is because of the large list which keeps growing with each iteration. Is there any way I can compile this without losing all the memory space? If I paste the code into a hard disk, and if I run it from there, will that solve the issue? I am using spyder. Thanks in advance!
1
0
false
python,memory,spyder
2021-09-16T09:49:00.000
69,206,156
How to prevent the system space from running out while running the code
No, saving the program elsewhere from your IDE won't help with that. It's possible running it with the regular Python interpreter instead of something Spyder maybe embeds may help a bit. You'll need to either (from easiest to hardest): enable swap memory on your machine (which will make your program slow to run if it needs to use that swap memory) purchase and install more memory into your machine run your program on e.g. a cloud machine with more memory make your program use less memory with a more efficient algorithm (e.g. better data structures, or storing parts of the calculation on the disk).
0
0
1
78
69,209,652
1
I created a python virtual environment using root user and installed 9 python libraries on the virtual environment using the same user. The root access has been revoked now and am unable to access libraries using my own userid (that is not root). How can we change the permission of the libraries so that my userid can access them?
2
0
false
python,python-3.x,linux,unix
2021-09-16T13:39:00.000
69,209,523
Changing ownership of libraries installed on python virtual environment
The only user that is allowed to change the ownership or permissions of a file that they do not themselves own is the superuser (regular users can "super user do" using sudo, of course, but this is an exception that must be granted by the root user). In other words, you need someone with root access to change the ownership or access permissions.
0.099668
1
0
22
69,319,656
1
We have a scheduler service which gets spawned at the beginning of the program. We moved our code base from python2 to python 3. We are monkey patching with gevent before calling the scheduler thread. Once the gunicorn starts with let's say two workers. The scheduler_service run() method's code is forked and is served by all 3 threads in parallel. We want only one thread to handle it. What could be the issue as with python2 and without monkey patching it was working fine?
1
0
false
python-3.7,gunicorn,gevent
2021-09-16T17:34:00.000
69,212,861
Custom Scheduler thread after launching is being run parallelly by main thread and workers of gunicorn
This is exactly how it should be behaving. You need a singleton reference, shared among threads that allow for a master to take priority. Usually a database model that tracks the current online threads, with a checkin, and a failover logic if one no longer checks in as master.
0
0
0
205
69,224,927
1
Read The Docs seems to be stuck on an old version of my docs and whatever I do in won't update. I even tried deleting the project from Read The Docs completely and reimporting the github repo - it still shows the old version. The builds show as successful. To test this, I've changed a bit of text on the README.rst. It won't update. I've tried searching through all my project files for the old text, which is showing in the Read The Docs site - it doesn't exist in my files anywhere anymore so where is Read The Docs even getting it from? It isn't my cache or anything either. I've cleared the cache, loaded the page on Private windows, different browsers and even a different computer and still I get the old docs. Any ideas? I really have no idea what to try.
1
0
false
python,python-sphinx,read-the-docs
2021-09-17T09:04:00.000
69,220,691
Read The Docs Sphinx build not updating
It can take a while (an hour or two) for the change to propagate to the website. Probably some caching being done by Cloudfare or something. You can check the latest changes by clicking in the bottom left hand corner of the Documentation webpage and Downloading the html version - that seems to propagate immediately, probably it is a direct download from Read The Docs' servers.
0
0
0
56
69,221,776
1
I have a mongoDB document [A] containing a reference object id of another document [B]. Now when object [B] is deleted what is the best way to delete document [A] also b'coz it contains object id of document [B] which does not exist.
2
0
false
python,mongodb,fastapi
2021-09-17T10:07:00.000
69,221,562
When the referenced object is deleted then how we can delete the objects that have references to it in fastapi and mongoDB
I think the best solution is at where place object[B] has been deleted, after that update object[A] or delete object[A] ,
0
0
1
331
69,222,514
1
I first installed Spyder and then afterwards Python on a server (with Windows Server 2019) all on the directory "C:\Users\wi932\ .spyder-py3" and the Python folder "C:\Users\wi932\Python\Python38". Then I installed many packages (like tensorflow, matplotlib, scikitlearn) by using the command prompt of windows and pip from the directory "C:\Users\wi932\Python\Python38\Scripts" and it was okay. However, when running Spyder I can't use the packages that I installed using pip. Whenever I run a Python programm with those modules I get an error message "ModuleNotFoundError: No module named 'tensorflow'". So the question is how can I build a "connection" between the pip and Spyder? Does anyone have an idea? I'll appreciate every comment.
1
0
false
python,pip,spyder
2021-09-17T11:03:00.000
69,222,344
Spyder can't find installed modules with pip
Have you considered installing anaconda? Spyder comes as a part of this and is easy to install from the anaconda client. You can also create your base environment in the anaconda client and then switch to pip to install packages from there.
0.197375
1
2
125
69,255,130
1
I am parallelizing emcee using multiprocessing module as stated in the emcee document. However, htop shows that the program keeps using a limited number of cores (26-27). The computer I am running my code on has 80 available cores and I would like to make use of all of them to speed up the code. Can someone please help me with this? I did not find any solution in the document.
1
0
true
python,multiprocessing,pool,emcee
2021-09-18T11:56:00.000
69,234,421
Multiprocessing the Python module 'emcee', but not all available cores on the machine are being used
In case someone runs into the same issue, I just found out that emcee will use a number of cores equal to half the number of walkers. In my case I had 50 walkers and hence, 25 CPU cores were being used.
1.2
1
1
39
69,240,032
1
I wrote some script with tkinter as a GUI and pyinstaller to convert it to an exe. However gmail doesn’t allow me to share the file if I share the file with google drive then windows security gets triggered What’s a good safe and easy way for people who don’t know how to install python to use the code I write in python. Thank you
1
1
false
python,user-interface,tkinter,pyinstaller,exe
2021-09-18T21:21:00.000
69,238,534
Share script with non coders
You could use Discord. I believe you can upload an exe to Discord.
0.197375
1
0
55
69,241,429
1
I have a python file main.py which does some algo trading in finvaisa broker. I want to run the same file mulple times by changing some params etc.. what i did was -> I ran Main.py in first terminal -> Opened new terminal in VSCode and ran Main.py again doing some changes -> Now after sometime the first terminal is having error like "Session invalidated", My program, connects finavasia broker and places some orders etc.. and if i am running two sessions parallelly, then two programs simultaneuously access the broker and causing issues. I tried with few other brokers and its working fine with them, only finavaisa is having this issue. Can anyone let me know is there any alternate way to run the same file in multiple sessions. May be something like, keeping alive the connection string and that can be used whenever i run any python file at any time? I am new to python, Please help me
1
0
false
python,visual-studio-code,pyalgotrade
2021-09-19T06:53:00.000
69,240,999
Couldnt run same python file multiple times in VSCode, getting "Session invalidated Error"
Your main.py file will use the same Port for sending requests to Algo Server which is why you receive an error the second time, as that Port is already running a process. Can you kindly share the socket/config params or details for more clarification?
0
0
-1
124
69,242,315
1
I'm using macOS and need to downgrade my Python 3.9 (not conda) to 3.7.7, for which purpose I wanted to remove the version from Library/Frameworks like the former ones but didn't find there. Help would be appreciated. Thanks.
2
1
false
python,macos
2021-09-19T09:57:00.000
69,242,194
How to either downgrade or remove Python 3.9 on macOS
If you want to set specific version, use it like this:WARNING: This command will overwrite the python version system-wise.
-0.197375
-2
0
169
69,268,147
1
I am working with image dataset but its imbalanced and I work to solve it using under-sampling but it needed more memory, how can save memory, or how can work with large image dataset need to resampling ( imbalance image dataset) and that need RAM large 17 GB in python language and especially on Kaggle ?
1
0
false
python,size,ram,kaggle
2021-09-19T10:21:00.000
69,242,352
How can increasing RAM size on Kaggle (python)?
The best solution would be to avoid memory leaks or to process data in chunks. Otherwise, if you really need to load a very large data set into memory, currently the only option is to upgrade the notebook to Google Cloud AI Platform Notebook, but that is not free.
0
0
0
41
69,244,640
1
so I have to create a List of a big range and am trying to accomplish this with list(range(number1, number2))and the numbers number1 and number2 can have a big difference, for example 235 and 4323246376. Now, this takes a long time to process. Can this process be sped up?
2
0
false
python,list,performance,range
2021-09-19T15:09:00.000
69,244,501
Creating a List of a Range is slow, are there alternatives?
What use case are you going to achieve with this? In case you are going to use this list once, don't typecast the range object into a list. When you typecast the range object into a list, It stores all the numbers in a list which costs you memory. You can just iterate over the range object.
0
0
0
470
69,249,572
2
I downloaded a library and need to make changes to the source code/source file. The library seems to be located at /usr/local/lib/python3.7/dist-packages. Where can I find the files on Windows?
2
0
false
python,windows,google-colaboratory
2021-09-20T05:29:00.000
69,249,457
find and edit source code of installed python libraries in Google Colab on Windows
First of all, find out where Python is installed on Windows. Incase if you installed Python by downloading the application from its website, the application should be installed by default in C:\Users\UserName\AppData\Local\Programs\Python\Python39 Once you opened the installation folder, head over to the Lib\site-packages directory and you can find the source code folders of installed packages. Hope that helps to solve your problem.
0
0
0
470
69,249,543
2
I downloaded a library and need to make changes to the source code/source file. The library seems to be located at /usr/local/lib/python3.7/dist-packages. Where can I find the files on Windows?
2
0
false
python,windows,google-colaboratory
2021-09-20T05:29:00.000
69,249,457
find and edit source code of installed python libraries in Google Colab on Windows
By default the install location is C:\Python39 - so it would be C:\Python39\Lib\site-packages
0
0
1
195
69,249,853
1
I have 4 functions: firstfunc() secondfunc() thirdfunc() forthfunc() I want to run these functions sequentially(order doesn't matter) and not together, I need the functions to wait till one of them completes the task, and then another one should start executing. Each function returns a different value which is then to be stored in a variable and later used for further data processing. How can this be done in python? I am kinda a novice in python.
1
1
false
python,multithreading,function,locking
2021-09-20T06:03:00.000
69,249,713
Run another function only when the previous function is finished in python
Programming language execute from top unless stated otherwise by the use of conditional statements. What you want to achieve here is pretty the way you arrange it. Execute the first one followed by the second and so on.
0.197375
1
0
200
69,263,646
1
I had made more than 1 pytest test files I needed it to be convert them to a single exe file I used pyinstaller for that not able to convert the test cases to .exe file Even though if some how I will convert it I could not run it via clicking on .exe file as on console I am running it by python -m pytest So Please help me guys
2
1
false
python,pytest,pyinstaller
2021-09-20T14:12:00.000
69,255,920
Execute pytest via pyinstaller created exe extension file
Is there any way to execute the exe file created by pyinstaller, that like on just clicking the exe file the exe will get execute based on the code mentioned just like on clicking the exe file the code should execute via python -m pytest
0
0
1
62
69,265,180
1
Suppose we have 2 AVL trees (with methods insert(key) and delete(key)), but in one of them there exist corrupted nodes (the number of corrupted nodes is much less than the total number of nodes in that tree). We want to merge 2 AVL trees into 1 single AVL tree such that the corrupted nodes are removed (we have the list of keys of corrupted nodes). The "naive" algorithm is (assume tree 1 contains corrupted nodes): For each of the corrupted nodes, delete it from tree 1. Then insert all remaining nodes from tree 1 to tree 2, so the final AVL tree is the "merged" tree we want. Now the question is coming up with a more efficient way to merge 2 trees, better than the naive algorithm above. Anyone has any idea? Thanks for your help!
1
0
true
python,database,algorithm,avl-tree,lookup-tables
2021-09-21T06:08:00.000
69,264,141
Merge 2 AVL trees with corrupted nodes in one of them
A binary search tree can list its nodes in increasing order in linear time O(N). You can organize a merging process where you enumerate the nodes of both trees simultaneously, fetching the nodes in global order (and dropping the corrupt ones). If you store the sorted elements in an array, it is possible to convert to a new balanced BST in linear time. You make it AVL by just setting all balance factors. I doubt that it is possible to construct the new tree without first merging to an intermediate array. (Which only needs to be an array of pointers.)
1.2
0
1
89
69,269,872
1
So I'm having 3 days education seminar which isn't of much use for me, so I'm writing my program on a paper and I'm wondering something since I can't test it at-the-moment. I'm basically scanning my screen for image, and screen is divided into 8 segments. I don't need to scan all 8 segments, but for instance now, let's say I only need to scan 5 out of those 8 where image can pop out. Is it faster to just make pyautogui to scan whole screen and write down coordinates where image was seen, and I'll then know by coordinated on which screen it popped, or is it faster to make multiple pyautogui searches with defined regions? So is it faster if pyautogui searches whole screen once or if pyautogui makes multiple searches with defined regions, searching only 20-70% of screen? If it depends on how much screen in the end I search, what would be aproximate percentage where one becomes faster than other? For instance: searching 4 times 50% of screen is faster than searching once 100% screen, but searching 6 times 75% of screen is slower than searching once 100%.
1
0
true
python,python-3.x,pyautogui
2021-09-21T13:02:00.000
69,269,376
Pyautogui - which approach is faster?
I think that the faster and more efficient/accurate process here would be searching the whole screen through pyautogui and write down the coordinates where the image was seen, and you then knowing by the coordinated on which screen it popped... So I would reccomend using this method as the second methos would be more slower and not as efficient as this
1.2
0
-1
1,332
69,344,395
1
I am getting this warning while I was trying to install django in a virtual environment in pycharm. But while I open python in command prompt then I don't get any warning like 'python is not in path or something', then why am I getting this warning now in pycharm? pls help me fix this, thankyou in advance.
1
0
false
python,django,path,pycharm,virtualenv
2021-09-22T02:18:00.000
69,277,413
The script sqlformat.exe is installed in directory , which is not on PATH
The complete directory can be added to path by: Right-clicking "This PC" and going to "Properties". Clicking on the "Advanced system settings" present under "Related Settings". Clicking on the "Environment Variables" button o​n the bottom right. In the "System variables" section, selecting the "Path" variable and clicking on "Edit". (The next screen will show all the directories that are currently a part of the PATH variable.) Clicking on "New" and entering path of directory which is supposedly said to be missing from the warning message you got.
-0.379949
-2
1
169
69,278,190
1
I've entered login information during tests but I no longer want this data to be present in the source code which will be uploaded to GitHub soon. How can I make use of this data in the tests without storing the login info in the source code? Is it safe to store it in an environment variable? A database? A local file? What's the best way to go about encrypting and decrypting this info?
2
2
false
python,unit-testing,security,privacy
2021-09-22T04:13:00.000
69,278,105
How to use sensitive data in unit tests?
If your project working fine , you can use/add spy method in to code and validate/add unit test for the login file. (spyse used to get actual response from methods to test files, its inbuild feature in unit tests). If you use secret for login, anybody can add console and check your credentials, I'm not sure that's good idea if you upload to github.
0.099668
1
0
53
69,278,482
1
I am stuck on a problem about Olympics athletes. I need to find the number of different sports each country participates in from my data frame, I am unsure how to do this as the column 'country' obviously has duplicates as well as the column 'sport' and I cant figure out how to group them and return a value for each country Any help would be awesome :)
2
0
false
python,pandas,dataframe
2021-09-22T04:18:00.000
69,278,131
Finding number of times a sport comes up for each country python data frame
import pandas as pd df = pd.DataFrame([{'Country': 'India', 'Sport': 'Badmintan'}, {'Country': 'China', 'Sport': 'Badmintan'},{'Country': 'India', 'Sport': 'Football'}]) print(df) print(df.groupby(by=('Country')).count()) Answer: Country China 1 India 2
0
0
0
605
70,478,710
1
Invoke-Expression : At line:1 char: 522 ...ntel Wireless Common;C:\WINDOWS\System32\OpenSSH;"C:\Mingw\bin;c:\MinG token 'C:\Mingw\bin' in expression or statement. C:\Users\admin anaconda3 shell\condabin Conda.psm1:107 char:9 Invoke-Expression -Command SactivateCommand; CategoryInfo : ParserError: (:) [Invoke-Expression), ParseExcep tion FullyQualifiedErrorid : Unexpected Token, Microsoft PowerShell.Commands. In vokeExpressionCommand
2
0
false
python
2021-09-22T05:03:00.000
69,278,454
when I open anaconda prompt it's showing an error of mentioned below.how to resolve this issue?
The variables of the path are wrong for the "C:\Mingw\bin;c:\MinG token 'C:\Mingw\bin' have you noticed that there are double quote and single quote there. these signs caused problem. you have to correct these variables in you path.
0
0
0
88
69,278,712
1
I have a lot of .dst files. I have to convert all files into .jpg. I tried with pyembroidery module in python, but I don't know how to save the conversion file. Can anyone please help me.
2
1
false
python
2021-09-22T05:30:00.000
69,278,681
How to convert .dst file to .jpg format using python?
Import the Image module from PIL the os module. Import the image to be converted using the Image.open() method. Display the size of the image before the conversion using the os.path.getsize() method. Convert the image using the Image.convert() method. Pass "RGB" as the parameter. Export the image using the Image.save() method. Display the size of the image after the conversion using the os.path.getsize() method.
0
0
1
46
69,281,669
1
I'm currently a student making a project that requires eye tracking. I found that most eye tracking codes online only tracks the movement of the face and placement of the eyes. Is it possible to create a code that can track where the eyes are across the screen? Thanks!
1
0
false
python,opencv
2021-09-22T09:32:00.000
69,281,606
Is it possible to create a eye tracking code that can track where the users eye is going across the screen?
Is it possible Yes. Is it easy No. Among other things there is research in this for off-boresight targetting of missiles. Some 'anti-cheating' packages for online testing do something similar, but I've not checked how they work. Think about it: the problem of working out where an eye is focusing is a lot more complicated than tracking where a face is pointing.
0.197375
1
0
36
69,359,674
1
I am using some bioinformatics software that requires a python2 environment. I use conda to create a new environment and specify the python version as 2.7.18, but when I type 'python' I find that the python version is 3.9.5. I use the 'which python'code, and ls -l the link, and get return lrwxrwxrwx 1 leelee leelee 9 9月 22 20:06 /home/leelee/miniconda3/envs/clear2/bin/python -> python2.7 I type 'python2.7' and got the version I wanted. But it is still 3.9.5 when type 'python'. I am very confused about this, how can I solve this problem.
1
0
false
python,python-3.x
2021-09-22T12:28:00.000
69,284,243
can't I change the python version of conda
using code below to check what env you have conda env list and you will get a list of env you create then using conda activate env_name to activate and get in the env then you can use the python version you want. if you can't get the python path you want by using which python when you are in an env you need to edit your bash/zsh file to check that is there a python default path setting there.
0
0
0
26
69,298,811
1
I've installed Python3.8 64bit into C:/Python38 on a Win7 machine (I know, but let's assume I can't upgrade to Win10 !). I've googled and tried everything but I can't set C:/Python38/python.exe to be the default program to run .py files when I double click on them. If I do the usual 'Open With->Choose Default Program' and browse to C:/Python38/python.exe it will not assign it. Sounds like a FAQ, but I can't find a solution that works.
1
0
false
python,python-3.x,windows-7
2021-09-22T14:51:00.000
69,286,642
Windows 7 'Choose Default Program' for Python 3x
I previously had Python2.7 installed when I installed 3.8 (including the Python Launcher) the Registry key HKEY_CLASSES_ROOT\Python.File\shell\open\command was not updated. I set it manually to "C:\Windows\py.exe" "%L" %* Now the launcher points to 3.8
0
0
0
40
69,299,452
1
I've created the class CustomErr (inherits from Python's Exception) long time ago and I'm using it on a few hundred places in code. It has a member method which is declared with def logErr(self). After some time I found that this function should have mandatory keyword argument logger, so I've changed declaration of the function to def logErr(self, *, logger). After this change I've expected a few hundred compiler errors, or at least warnings (so it will be easy for me to make needed changes), but it didn't happen - there is not a single error reported. I only get runtime exception when this function is called. Did I expect too much from Python compiler and/or my working IDE (I'm using Eclipse with PyDev 8.1, Python 3.8.7)? Do I need a Python linter ?
1
0
false
python,pydev
2021-09-23T07:14:00.000
69,295,462
Mandatory member function arguments - to much expectations from Python compiler and/or PyDev
PyDev by default doesn't really provide this checking -- it does have code-analysis builtin, but it focuses on being very fast and on having very few false positives and it doesn't really delve in the type-checking territory. In PyDev the recommended way to work with this is through an external linter or type-checker. PyDev has integrations with Flake8, Mypy and PyLint (the related configuration in the preferences is under PyDev > Editor > Code Analysis > Flake8/Mypy/PyLint). If you're using type hints in your code, enabling Mypy is probably a no-brainer and actually required to make use of such typing for code analysis in PyDev... out of the box PyDev will use that info for code-completion, but there aren't plans to add it for code analysis as I'm a bit worried about duplicating what's already available in Mypy anyways and I don't see much positives in having yet another type checker. PyLint may also be interesting as it does get some interesting errors (but in my experience it usually also has a higher false positive ratio, so, it may need to be tweaked a bit more) -- if you don't use type-hints (and thus wouldn't really get much from Mypy), I think that using PyLint is interesting as it does try to cover more ground than PyDev. As a note, if you're not using type-checking/MyPy, what you want is probably not achievable with 100% certainty by any tool because it's difficult to find out that something as parameter.logErr means the logErr in your CustomErr and not really some other logErr somewhere else (because discovering that the type of parameter is CustomErr is really hard). p.s.: automatically running the type-checker/linter is done for each file as you save it, but you can also run it for the whole project by right-clicking a project/file and then selecting PyDev > Code Analysis.
0
0
1
54
69,309,644
1
I used pyinstaller to convert py into exe, for opening .jpg files. I would like to get the jpg path (not the executable) where my application is running from, so that it can open the jpg directly by double-clicking the jpg. Could you advise how to achieve this in python? Thanks!
1
0
false
python,executable,desktop-application
2021-09-24T04:15:00.000
69,309,489
Get file path (not the executable) where application is running from?
Tried sys.argv[1] and it works, while os.getcwd() returned "C:\WINDOWS\system32". Not sure why the comment was removed but thanks!
0.197375
1
0
186
69,382,625
1
I have installed Anaconda in Ubuntu and then installed the ViennaRNA in anaconda using the following command: conda install -c bioconda viennarna But when I run the code: import RNA It shows the following error: ModuleNotFoundError: No module named 'RNA' Does anyone know how to solve it?
1
0
false
python,anaconda
2021-09-24T22:29:00.000
69,321,661
ModuleNotFoundError: No module named 'RNA'
I used python3.6 -c import RNA instead of python -c import RNA and it worked.
0
0
1
52
69,325,084
2
Many modern software has dependency on python language and they -as a consequence- install their own versions of python with the necessary libraries for each particular software to work properly. In my case, I have my own python that I downloaded intentionally using anaconda distribution, but I also have the ones came with ArcGIS, QGIS, and others. I have difficulties distinguishing which python -say- I am updating or adding libraries to when reaching them from the command line, and these are not environments but rather the full python packages. What is the best way to tackle that? Is there a way to force new software to create new environments within one central python distribution instead of loosing track of all the copies existing in my computer?! Note that I am aware that QGIS can be downloaded now through conda, which reduces the size of my problem, but doesn't completely solve it. Moreover, that version of QGIS comes with its own issues. Thank you very much.
2
1
false
python,arcgis,qgis
2021-09-25T09:42:00.000
69,324,941
Managing Multiple Python installations
You can use pyenv to manage python versions in your system. Using pyenv you can easily switch between multiple versions. And as suggested - each project can create a virtual environment. You have multiple options here - venv, virtualenv, virtualenvwrapper, pipenv, poetry ... etc.
0.099668
1
1
52
69,325,033
2
Many modern software has dependency on python language and they -as a consequence- install their own versions of python with the necessary libraries for each particular software to work properly. In my case, I have my own python that I downloaded intentionally using anaconda distribution, but I also have the ones came with ArcGIS, QGIS, and others. I have difficulties distinguishing which python -say- I am updating or adding libraries to when reaching them from the command line, and these are not environments but rather the full python packages. What is the best way to tackle that? Is there a way to force new software to create new environments within one central python distribution instead of loosing track of all the copies existing in my computer?! Note that I am aware that QGIS can be downloaded now through conda, which reduces the size of my problem, but doesn't completely solve it. Moreover, that version of QGIS comes with its own issues. Thank you very much.
2
1
false
python,arcgis,qgis
2021-09-25T09:42:00.000
69,324,941
Managing Multiple Python installations
as Nukala suggested, that's exactly what virtual environments are for. It contains a particular version of a python interpreter and a set of libraries to be used by a single (or sometimes multiple) project. If you use IDE:s such as Pycharm, it handles the venvs for you automatically.
0.099668
1
0
2,041
69,358,670
1
In vscode, we can install the python extension, then select the interpreter which we want, like python in the conda environment. So we can use "shift" + "enter" key for running the code line by line in the terminal. For managing different virtual environment, using docker container is a better way. If I already install the docker, and pull the python image. How to select the interpreter which is created in the docker container? Not just remote to the docker container.
4
4
false
python,docker,visual-studio-code
2021-09-25T13:06:00.000
69,326,427
Select interpreter of docker container in the vscode
I think it's impossible, I am afraid you must remote to the docker container. I really can't imagine out you taking a python interpreter in Linux to work on windows directly.
0
0
2
116
69,335,798
1
I was wondering if there is some extension/framework/module to VScode/python that allows you to run code in blocks like on Google Colab, so you don't have to run time-consuming lines every time you change something not related in code. I'm pretty sure I saw something like that somewhere, but I don't know how it is named.
1
0
true
python,visual-studio-code,pip,google-colaboratory
2021-09-26T14:08:00.000
69,335,717
Google Colab code blocks like feature in VScode
The extension is called jupyter by Microsoft. Install that and then Create the file with the extension .ipynb and you are good to go.
1.2
1
2
120
69,338,073
1
I tried convert python script into exe using pyinstaller, so I ran the following command: pyinstaller --onefile app.py, and it seems that the exe file created successfully, but when I tried running the exe an error occurred: ModuleNotFoundError: No module named 'PyPDF2'. I read that pyinstaller doesn't see second level imports, so I ran the following command: pyinstaller --hidden-import PyPDF2 --onefile app.py, but the error remains the same. Do you have any solution for this problem?
1
0
true
python,pyinstaller,pypdf2
2021-09-26T18:52:00.000
69,337,984
PyPDF2 with PyInstaller
i just made an exe with pypdf2 in it using pyinstaller (literally a few days ago) ... i import it at the top of my main file and it bundled in just fine my guess as to the issue is that PyPDF2 is not installed in the python that you are getting using pyinstaller first open a terminal and run python myscript.py and make sure it runs correctly with that version of python next run python -m pyinstaller --onefile myscript.py this will ensure that it is using the correct python version (the one with pyPDF2 installed) (at the top of myscript.py make sure to import PyPDF2)
1.2
1