while in visual studio, I downloaded nltk for python 3.5, then downloaded python 2.7. Instead of installing nltk library again, I copied it and its .dist-info file to python 2.7 directory. Now, working in python 2.7' I'm getting an import warning error. cElementTree.py opens up automatically, displaying an error at from element tree import line. I did Intellisense/Refresh DB and checked Import warning in Open Exceptions Settings -didn't help. Ignoring this error, my program compiles, but seeing it every time I press F5 is annoying.
Related
I can't run OpenPose in Python even though I've followed every step, BUILD_PYTHON is marked, I have the 3 files inside build/python/openpose/Release, and I am running the tutorial examples in the console command from build/examples/tutorial_api_python.
I have even tried copying the rest of .dll from the release version except for my generated "openpose.dll" to build/x64/Release.
Nothing has worked, I get the same error all the time: "DLL load failed while importing pyopenpose".
Also tried with Pythin 3.10.7 and 3.7.9, same result.
I was trying to schedule a new python code by running with a BAT file, but was getting an error that the statsmodels package was not present. The package loaded fine in Spyder, but not when running from a BAT file. I followed a thread here that suggested updating my packages in console (pip command) which I did.
That led to a new error that NumPy was not loading. I noticed that I now had 2 versions of NumPy (1.19.1 and 1.19.2). Further searches yielded advise to uninstall and reinstall NumPy. I had to uninstall twice to get rid of both versions, then installing left me with 1.19.2.
Now, when I run my code in Spyder, I get a strange error on pd.read_csv:
"Only callable can be used as callback"
I couldn't find anyone getting this error from pd.read_csv. Next, I tried to run pd.read_excel in Spyder, but I get this error message:
"int() argument must be a string, a bytes-like object or a number, not '_NoValueType'"
This is code that worked fine yesterday on files that have not changed, so it is not the files. I even made a couple test files and get the same error. Trying to load statsmodels in Spyder now fails:
"from statsmodels.tsa.ar_model import AutoReg"
"AttributeError: module 'numpy.core' has no attribute 'records'"
Running the same code in BAT, reading csv and excel files DO work, but still hangs up on loading statsmodels.
I think at this point, I need to reload Anaconda, but I don't understand why code that works in Spyder does not work running from BAT file, when I am referencing the only copy of python that I have in Anaconda.
Thanks,
It seems to be fine today, so perhaps I needed a full reboot to implement the updates? I don't remember doing this in the past.
I'm still having the original issue with loading the statsmodels package when running from BAT file, but I will ask that in a new post.
I'm running Python code in VS Code (1.28.2, with the Python, and Python Extension Pack extensions) and am using the 'Run Selection/Line in Python Terminal' (Shift+Enter) functionality to just run selected code in the Python terminal.
This has always worked well, but today I'm getting a new line added between each line of code in the terminal, i.e. if I ran:
import heapq
import pickle
the output in the terminal would be:
>>>import heapq
>>>
>>>import pickle
At first, this just seems like an annoyance, but any for loops or functions now come out with an indentation error...so essentially I can't successfully run any code.
I've tried re-installing VS Code as well as installing an older version of VS Code but all give the same problem.
It's so odd because it was working fine and then all of a sudden it changed. The only thing I can think of that has possibly changed is I installed the JSON Tools extension, but I don't believe this would change anything within Python (and I've tried uninstalling this, and not loading it again when reinstalling VS Code from scratch)
Any help would be greatly appreciated!
It's a bug that will be fixed in the 2018.9.1 release of the Python extension.
When I try to import time I get : No module named time
I have tried other time modules(datetime and timeit) and they work fine. I decided to check my installation and I can't find time.py anywhere. I checked the Lib, Scripts, libs and include folders, but can't find it anywhere.
Anyone know what I can do to fix this? Maybe download the .py and put it in Lib myself?
I am using Python 3.3.5 with PyCharm IDE. Only extra scripts I've installed is EasyInstall and PRAW.
The import does work. When PyCharm said No module named time, I assumed I would get a compiler error and started trying to fix it.
However when I eventually just ran the code it worked fine. I expect PyCharm doesn't detect the time module as it's a dll and not a py as noted by Martijn in the comments. This is on PyCharm Community Edition 4.0.4.
I tried playing with virtualenv and a host of other things, but I eventually went to Preferences -> Build, Execution, Deployment -> Console -> Python Console, and in the "starting script" box, I added two lines:
sys.builtin_module_names.append('sys')
sys.builtin_module_names.append('time')
This got rid of errors I had with both sys and time. Once I did that, I even get autocomplete for both of those modules... weird.
Context
Steps taken:
Environment Setup
I've installed protobufs via Home Brew
I've also followed the steps in the proto-bufs python folder's readme on installing python protobufs - namely running the python setup.py install command
I've using the protobuf-2.4.1 files
Coding
I have a python file (generated from a .proto file I compiled) that contains the statement, among other import statements, but I believe this one is the one causing issues:
from google.protobuf import descriptor_pb2
The above python file, I'm importing in another python file, it's
this python file that I want to write up logic for parsing the
protobufs data files I receive
Error received
I get this error when running that file:
Steps taken to fix
Searched google for that error - didn't find much
Looked at this question/answer Why do I see "cannot import name descriptor_pb2" error when using Google Protocol Buffers?
I don't really understand the above questions selected answer,I tried to run the command in the above answer protoc descriptor.proto --python_out=gen/ by coping and pasting it in the terminal in different places but couldn't get it to work
Question
How do I fix this error?
What is the underlying cause?
How do I check if the rest of my protobuf python compiler/classes are set up correctly?
I've discovered the issue. I had not run the python install instructions the first time I tried to compile this file. I recompiled the file and this issue was fixed.