Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with pyodbc installation in venv python 3.10 #1020

Closed
myamullaciencia opened this issue Jan 31, 2022 · 11 comments
Closed

Issues with pyodbc installation in venv python 3.10 #1020

myamullaciencia opened this issue Jan 31, 2022 · 11 comments

Comments

@myamullaciencia
Copy link

I have these environment and i would like to install pyodbc to work with accdb and mdb files.

  • Python: 3.10
  • OS: windows 10 64bit

I have created a virtual environment venv where i 'm trying to install the pyodbc as

python -m pip install pyodbc

Here it gives an error as:

Collecting pyodbc
  Using cached pyodbc-4.0.32.tar.gz (280 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pyodbc, since package 'wheel' is not installed.
Installing collected packages: pyodbc
  Running setup.py install for pyodbc ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyodbc did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running install
      running build
      running build_ext
      building 'pyodbc' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyodbc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I have verified that MS Visual C++ is already installed and but it is still giving an error.

could you please help me out to solve this on priority ?

@gordthompson
Copy link
Collaborator

Duplicate of #981

@gordthompson gordthompson marked this as a duplicate of #981 Jan 31, 2022
@myamullaciencia
Copy link
Author

Are these unofficial wheels as a workaround (https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc)) safer ? any other work around ? and when can we expect this to be support python 3.10?

@myamullaciencia
Copy link
Author

if my python downgrades to 3.7 would this be worked out ?

@gordthompson
Copy link
Collaborator

if my python downgrades to 3.7 would this be worked out ?

Yes, there are Windows wheels for Python 3.7 on PyPI.

@Bhavya-official
Copy link

@khaihc
Copy link

khaihc commented Apr 2, 2022

I downgraded python to 3.7. I ran the command python application.py and still error ModuleNotFoundError: No module named 'pyodbc'. How can I fix it?
This is my error
<<
(venv) testadmin@linux-vm-west2:~/testadmin$ python application.py

  • Serving Flask app 'FlaskExercise' (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: on
  • Running on http://localhost:5555 (Press CTRL+C to quit)
  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 239-286-056
    127.0.0.1 - - [02/Apr/2022 13:59:31] "GET / HTTP/1.1" 500 -
    Traceback (most recent call last):
    File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/util/_collections.py", line 1008, in call
    return self.registry[key]
    KeyError: <greenlet.greenlet object at 0x7efc3a06cbf0 (otid=0x7efc3a0803c0) current active started main>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/testadmin/venv/lib/python3.8/site-packages/flask/app.py", line 2095, in call
return self.wsgi_app(environ, start_response)
File "/home/testadmin/venv/lib/python3.8/site-packages/flask/app.py", line 2080, in wsgi_app
response = self.handle_exception(e)
File "/home/testadmin/venv/lib/python3.8/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/home/testadmin/venv/lib/python3.8/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/testadmin/venv/lib/python3.8/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/home/testadmin/venv/lib/python3.8/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/testadmin/FlaskExercise/views.py", line 12, in home
animals = models.Animal.query.all()
File "/home/testadmin/venv/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 552, in get
return type.query_class(mapper, session=self.sa.session())
File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/orm/scoping.py", line 47, in call
sess = self.registry()
File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/util/collections.py", line 1010, in call
return self.registry.setdefault(key, self.createfunc())
File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 4205, in call
return self.class
(**local_kw)
File "/home/testadmin/venv/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 176, in init
bind = options.pop('bind', None) or db.engine
File "/home/testadmin/venv/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 998, in engine
return self.get_engine()
File "/home/testadmin/venv/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 1017, in get_engine
return connector.get_engine()
File "/home/testadmin/venv/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 594, in get_engine
self._engine = rv = self._sa.create_engine(sa_url, options)
File "/home/testadmin/venv/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 1027, in create_engine
return sqlalchemy.create_engine(sa_url, **engine_opts)
File "", line 2, in create_engine
File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
return fn(*args, **kwargs)
File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 560, in create_engine
dbapi = dialect_cls.dbapi(**dbapi_args)
File "/home/testadmin/venv/lib/python3.8/site-packages/sqlalchemy/connectors/pyodbc.py", line 43, in dbapi
return import("pyodbc")
ModuleNotFoundError: No module named 'pyodbc'
127.0.0.1 - - [02/Apr/2022 13:59:31] "GET /?debugger=yes&cmd=resource&f=style.css HTTP/1.1" 304 -
127.0.0.1 - - [02/Apr/2022 13:59:31] "GET /?debugger=yes&cmd=resource&f=debugger.js HTTP/1.1" 304 -
127.0.0.1 - - [02/Apr/2022 13:59:32] "GET /?debugger=yes&cmd=resource&f=console.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Apr/2022 13:59:32] "GET /?debugger=yes&cmd=resource&f=console.png HTTP/1.1" 304 -

@v-chojas
Copy link
Contributor

v-chojas commented Apr 4, 2022

Are you sure you're using Python 3.7 ? Those paths say 3.8.

@khaihc
Copy link

khaihc commented Apr 4, 2022

Are you sure you're using Python 3.7 ? Those paths say 3.8.

oh sorry, I just downgraded to 3.7 and still got the same error

@gordthompson
Copy link
Collaborator

https://stackoverflow.com/a/19549035/2144390

@afrinjamanbd
Copy link

Checked Everything including python path, version , dependencies etc. Nothing works.

@robertoOlmedo
Copy link

Here
https://docs.microsoft.com/en-us/azure/databricks/kb/libraries/install-pyodbc-on-cluster
In Set up solution in a single notebook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants