Error while configuring pycharm with odoo-13 - python-3.x

I am trying to configure a new project to Odoo on Windows however when I run the project after specifying odoo-bin as the Script path this error appears to my:
Traceback (most recent call last):
File "D:/Odoo 13_20200903/server/odoo-bin", line 5, in <module>
import odoo
File "D:\Odoo 13_20200903\server\odoo\__init__.py", line 75, in <module>
import PyPDF2
ModuleNotFoundError: No module named 'PyPDF2'
Any idea how can it be fixed?
Thanks in Advance

The Python interpreter used differs from the interpreter in which the libraries are loaded, make sure that the required interpreter path, may be inside a venv or another name.

Related

ImportError: cannot import name 'cpyHook' from partially initialized module 'pyWinhook'

This has been plaguing me for a while now, and I'm not sure what to do about it. I've tried modifying the init.py pyWinhook script's imports, but to no avail. Here's the whole error:
Traceback (most recent call last):
File "d:\myuser\Documents\Python\evil_programs\keylogger.py", line 6, in <module>
import pyWinhook as pyHook
File "C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\__init__.py", line 1, in <module>
from .HookManager import *
File "C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\HookManager.py", line 1, in <module>
from . import cpyHook
ImportError: cannot import name 'cpyHook' from partially initialized module 'pyWinhook' (most likely due to a circular import) (C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\__init__.py)
Thanks in advance
The way I fixed this is by installing Python 3.8.
Python 3.10 and 3.11 produced this issue.
I got this idea from the executable name on GitHub "pyWinhook-1.6.2.win-amd64-py3.8.exe"
Why it does not work with newer python, I have no clue.

unable to run a python file because of Module not found error despite sourcing the pythonpath

I have been trying to run a python file using rosrun command but unfortunately I am having this module not found error because of a package named rospkg. Until a day before yesterday, it was all working fine but yesterday, ubuntu18.04 has got some updates out of which an update for ubuntu base was also present, since that update I am having this error.
I have tried to check whether I have installed the respective python-rospkg and its says I already have the latest version. I have also using
echo $PYTHONPATH
to check the sourced paths and they are sourced correct, I am not sure whats causing this error.
the error is as follows
Traceback (most recent call last
File
"/home/microbot/catkin_ws/src/spider/spider_control/control.py",
line 5, in <module>
import roslib
File "/opt/ros/melodic/lib/python2.7/dist-
packages/roslib/__init__.py", line 50, in <module>
from roslib.launcher import load_manifest
File "/opt/ros/melodic/lib/python2.7/dist-
packages/roslib/launcher.py", line 42, in <module>
import rospkg
ModuleNotFoundError: No module named 'rospkg'
The shebang for my is as follows,
#!/usr/bin/python3
When i try to run the file by changing the shebang to
#!/usr/bin/python2.7
I get the following error
Traceback (most recent call last):
File
"/home/microbot/catkin_ws/src/spider/spider_control/control.py",
line 3, in <module>
import tensorflow as tf
ImportError: No module named tensorflow
I have installed tensorflow version 1.14 using pip installation. Can anyone please help me solving this error. Thanks in advance
edit:
I have manually tried to set the python path to /usr/lib/python2.7/dist-packages as when I tried to install python-rospkg, it says the its already instaled in that location. Doing that I am having error importing tensorflow and the error is
`Traceback (most recent call last):
File
"/home/microbot/catkin_ws/src/spider/spider_control/control.py", line
3, in <module>
import tensorflow as tf
File "/home/microbot/.local/lib/python3.6/site-
packages/tensorflow/__init__.py", line 22, in <module>
import inspect as _inspect
File "/usr/lib/python3.6/inspect.py", line 41, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/usr/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:`

Jupyter Notebook in Anaconda Not Loading

Whenever I try to open Jupyter Notebook from the Anaconda GUI (or conda terminal), I get the following error:
Traceback (most recent call last):
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 10, in
import sqlite3
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\sqlite3\__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in
from .services.sessions.sessionmanager import SessionManager
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 13, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
I've gone so far as to uninstall Python, uninstall Anaconda, remove all python related path variables, and reinstall Anaconda with Python. This still has not worked. Is there any way to resolve this error? I've looked on many different sites but I haven't found much help.
EDIT: To add more context, it broke randomly one day and I don't have the slightest idea why. Anaconda had worked for a year or so prior. I checked both scripts that are referenced in the error prompt and they both exist in the directory.
I had the same problem.
The issue seems to arise from the missing of sqlite3.dll in the path ".\Anaconda\Dlls".(if using an env, you should put it under the env directory like ".\your env\DLLS") I solved it by simply copying that .dll file from others and put it under the path mentioned above.
You can download the sqlite3.dll from this link: sqlite3.dll

PyCharm unittests: AttributeError: module 'enum' has no attribute 'IntFlag'

I have an error that only appears when running unittests inside of PyCharm.
Python 3.6.5 on OSX.
/Users/me/project/env/bin/python /Applications/PyCharm.app/Contents/helpers/pycharm/_jb_unittest_runner.py --target test_module.TestClass.test_method
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pycharm/_jb_unittest_runner.py", line 4, in <module>
from unittest import main
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/__init__.py", line 58, in <module>
from .result import TestResult
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/result.py", line 5, in <module>
import traceback
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/Users/enos/patrf/api/env/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/Users/enos/patrf/api/env/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/Users/enos/patrf/api/env/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
This error seems related to Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?
The suggestions there don't work here.
Adding enum-compat to requirements.txt doesn't change anything.
A trivial unit test .py file that imports nothing at all still shows this problem.
There are no enum.py files in my project directory.
Happens with a clean virtualenv and a clean venv.
Everything works fine outside of PyCharm.
This only appears to happen in the one project I have that uses Graphene, which does have an enum.py, but even deleting those files has no effect. find . -name "enum.py" returns nothing.
Any PyCharm experts have an idea? I really like to run my tests inside of PyCharm and I'd love to be able to do so for this project.
I ran into this issue as well. I was able to solve it by removing the enum34 package. Even if you're using venv you need to make sure that you check all directories that the PyCharm Project Interpreter is adding to the PYTHONPATH. Just running pip uninstall enum34 may not fix the issue.
In my case, I had PyCharm loading extra directories to the PYTHONPATH and the enum34 package was included in one of them. Removing it from that directory solved the issue.

Builtin module not found when executing python script from cmd (python 3.6.5)

Please can you help, I am trying to run a python script from Windows cmd. The error message I get is:
File "C:\Program Files (x86)\WinPython\python-3.6.5.amd64\lib\site-packages\pandas\compat\__init__.py", line 48, in <module>
import __builtin__ as builtins
ModuleNotFoundError: No module named '__builtin__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\IndexTrader\code\futures_calc.py", line 16, in <module>
import pandas as pd
File "C:\Program Files (x86)\WinPython\python-3.6.5.amd64\lib\site-packages\pandas\__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "C:\Program Files (x86)\WinPython\python-3.6.5.amd64\lib\site-packages\pandas\compat\__init__.py", line 61, in <module>
import http.client as httplib
File "C:\Program Files (x86)\WinPython\python3.6.5.amd64\lib\http\client.py", line 71, in <module>
import email.parser
I run the python script within Spyder and python and the code executes with no problem or errors.
I am not sure what builtin package it is referring to. I beleieve the issue is with the pandas package (which I uninstalled and reinstalled).
I have successfully run the script from cmd before, so I am not sure what the issue is. I have also reinstalled WinPython, but this has not helped.
I am not sure what to do, I checked the system paths and everything is in order, I also added a PYTHONPATH as a System variable, but no luck.
Any ideas?

Resources