MLFlow -> ModuleNotFoundError: No module named 'sqlalchemy.future' - python

It seems to use MLFlow Model Registry locally, one option is to build my own backend database with SQLite.
I've found a site, which advised to run:
mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./artifacts --host 0.0.0.0 --port 5000
When running the command above, I get the following error message:
2022/05/22 23:08:58 ERROR mlflow.cli: Error initializing backend store
2022/05/22 23:08:58 ERROR mlflow.cli: No module named 'sqlalchemy.future'
Traceback (most recent call last):
File "/home/username/.local/lib/python3.8/site-packages/mlflow/cli.py", line 426, in server
initialize_backend_stores(backend_store_uri, default_artifact_root)
File "/home/username/.local/lib/python3.8/site-packages/mlflow/server/handlers.py", line 259, in initialize_backend_stores
_get_tracking_store(backend_store_uri, default_artifact_root)
File "/home/username/.local/lib/python3.8/site-packages/mlflow/server/handlers.py", line 244, in _get_tracking_store
_tracking_store = _tracking_store_registry.get_store(store_uri, artifact_root)
File "/home/username/.local/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/registry.py", line 39, in get_store
return self._get_store_with_resolved_uri(resolved_store_uri, artifact_uri)
File "/home/username/.local/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/registry.py", line 49, in _get_store_with_resolved_uri
return builder(store_uri=resolved_store_uri, artifact_uri=artifact_uri)
File "/home/username/.local/lib/python3.8/site-packages/mlflow/server/handlers.py", line 110, in _get_sqlalchemy_store
from mlflow.store.tracking.sqlalchemy_store import SqlAlchemyStore
File "/home/username/.local/lib/python3.8/site-packages/mlflow/store/tracking/sqlalchemy_store.py", line 11, in <module>
from sqlalchemy.future import select
ModuleNotFoundError: No module named 'sqlalchemy.future'
This seems odd, because if I run pip freeze, the sqlalchemy shows up, or if I do from sqlalchemy.future import select in a notebook, I get no error.
I think this may related to using a virtual environment. The current one I'm using is in /home/username/folder/mlflow/.mlflow but mlflow seems to be looking elsewhere for the file...

I resolved the issue by downgrading to a lower version of mlflow, (from v1.26.0 to v1.23.1).

Related

How to import autoitlibray into ride?

I tried to import autoitlibrary into Ride GUI but it failed with the below error.
"20200316 17:23:25.335 [WARN]: Importing test library "C:\Users\user\AppData/Local/Continuum/anaconda3/Lib/site-packages/RobotFramework/Extensions/AutoItLibrary/" failed
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\robotide\spec\librarymanager.py", line 86, in _fetch_keywords
library_name.replace('/', os.sep), os.path.abspath('.'))
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\robotide\spec\xmlreaders.py", line 99, in get_path
return _resolve_path(name.replace('/', os.sep), basedir)
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\robotide\spec\xmlreaders.py", line 116, in _resolve_path
raise robotapi.DataError"
Anything which am not doing it right??
Following the installation instructions on AutoItLibrary's project Readme, I found no problems. Special attention is the administrative privilege command. The version is 1.2.5 (which may be newer than the date of the question).
Screenshot of simple example with RIDE 2.0b1.dev0 (current development version):

Scrapy with Pycharm "ImportError: No module named settings"

I'm trying to get passed this error:
Traceback (most recent call last):
File "/Users/kdawod/.virtualenvs/python2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 168, in <module>
execute()
File "/Users/kdawod/.virtualenvs/python2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 109, in execute
settings = get_project_settings()
File "/Library/Python/2.7/site-packages/scrapy/utils/project.py", line 68, in get_project_settings
settings.setmodule(settings_module_path, priority='project')
File "/Library/Python/2.7/site-packages/scrapy/settings/__init__.py", line 292, in setmodule
module = import_module(module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named settings
It's only happening while running in PyCharm, however, it was working just fine the previous day.
I would be glad if you can help me figure out this issue and prevent it from happening in the future.
this is because Pycharm isn't finding the correct scrapy installation because it is trying to use the system's python version.
As you are using virtualenvwrapper outside Pycharm, you also need to define that inside. You have to specify the path of the python installation inside your virtual environment.
To select it in Pycharm go to:
Preferences -> Project: myproject -> Project Interpreter
and then select Add Local on the gear close to the upper-right corner which will help you browse where the correct python installation could be.

Cannot get gcloud to work with Python and Pycharm

I am trying to connect to the Google App Engine Datastore from my local machine. I have spent all day digging in to this without any luck.
I have tried the approach here (as well as alot of other suggestions from SO such as Using gcloud-python in GAE and Unable to run dev_appserver.py with gcloud):
How to access a remote datastore when running dev_appserver.py?
I first installed gcloud based on this description from google:
https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27
According to the description I should add the following to my appengine_config.py:
from google.appengine.ext import vendor
vendor.add('lib')
If I do that I get an error saying ImportError: No module named gcloud
If I then move the code to my main.py it seems to pickup the lib-folder and the modules there. That seems a bit strange to me, since I thought appengine_config was being run first to make sure things were initialised.
But now I am getting the following stack trace:
ERROR 2016-09-23 17:22:30,623 cgi.py:122] Traceback (most recent call last):
File "/Users/thomasd/Documents/github/myapp/main.py", line 10, in <module>
from gcloud import datastore
File "/Users/thomasd/Documents/github/myapp/lib/gcloud/__init__.py", line 17, in <module>
from pkg_resources import get_distribution
File "/Users/thomasd/Documents/github/myapp/lib/pkg_resources/__init__.py", line 2985, in <module>
#_call_aside
File "/Users/thomasd/Documents/github/myapp/lib/pkg_resources/__init__.py", line 2971, in _call_aside
f(*args, **kwargs)
File "/Users/thomasd/Documents/github/myapp/lib/pkg_resources/__init__.py", line 3013, in _initialize_master_working_set
dist.activate(replace=False)
File "/Users/thomasd/Documents/github/myapp/lib/pkg_resources/__init__.py", line 2544, in activate
declare_namespace(pkg)
File "/Users/thomasd/Documents/github/myapp/lib/pkg_resources/__init__.py", line 2118, in declare_namespace
_handle_ns(packageName, path_item)
File "/Users/thomasd/Documents/github/myapp/lib/pkg_resources/__init__.py", line 2057, in _handle_ns
loader.load_module(packageName)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/Library/Python/2.7/site-packages/google/cloud/logging/__init__.py", line 18, in <module>
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 999, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named google.cloud.logging.client
What am I doing wrong here?
The google-cloud library is not working on App Engine and most likely you don't even have to since you can use the build in functionality.
From the official docs you can use it like this:
import cloudstorage as gcs
I solved it this way:-
1.) Create a lib folder in your project path.
2.) Install gcloud libraries by running following command into terminal from your project path:-
pip install -t lib gcloud
3.) Create an appengine_config.py module in your project and add following lines of code:-
import sys
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
4.) After this, you can import like this:-
from gcloud import datastore
5.) To save data into live google datastore from local:-
client = datastore.Client("project-id")
key = client.key('Person')
entity = datastore.Entity(key=key)
entity['name'] = ashish
entity['age'] = 23
client.put(entity)
It will save an entity named Person having properties name and age. Do not forget to specify your correct project id.
Old question but this may be worth including:
I'm unsure the state of your requirements.txt file but I scrounged mine a bit and noticed setuptools was not included.
pip freeze doesn't export setuptools related question
Assuming you're following the tutorial, you likely installed those libraries EXCEPT for setuptools to lib.
I added setuptools=={verionnumber} to requirements.txt and that fixed this related issue for me.

Unable to start App Engine application after updating it via Google Cloud SDK

Recently, I have updated Google App Engine from 1.9.17 to 1.9.18 via Google Cloud SDK by using command 'gcloud components update' in Windows 7 64 bit. After that I wasn't able to start any project using the App Engine launcher. Getting this error:
Traceback (most recent call last):
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 36, in <module>
from google.appengine.tools.devappserver2 import dispatcher
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\dispatcher.py", line 29, in <module>
from google.appengine.tools.devappserver2 import module
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\module.py", line 71, in <module>
from google.appengine.tools.devappserver2 import vm_runtime_factory
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\vm_runtime_factory.py", line 25, in <module>
from google.appengine.tools.devappserver2 import vm_runtime_proxy
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\vm_runtime_proxy.py", line 29, in <module>
from google.appengine.tools.devappserver2 import log_manager
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\log_manager.py", line 34, in <module>
from google.appengine.tools.docker import containers
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\docker\containers.py", line 47, in <module>
import docker
ImportError: No module named docker
2015-03-05 19:11:27 (Process exited with code 1)
I even installed the latest Google Cloud SDK, but I'm getting the same error.
I'm able to install the appengine SDK 1.9.18(without using Google Cloud SDK) and able to run the project successfully.
This error is happening only for the App Engine launcher installed via Google Cloud SDK in Windows 7.
This issue is raised in App Engine Issue Tracker: Issue 125. I recommend you to star this issue.
This has happened to me today to reinstall the app engine sdk. I could not run my code in the launcher.
I remember reading that is not used pip app engine, but now I have solved the problem.
In short what I did was:
Install pip the footsteps of https://pip.pypa.io/en/latest/installing.html (this also correctly install the setuptools)
Install docker-py by pip: pip install docker-py and ready, I can now run my code in the launcher
P.S.
Previously I tried to install the docker-py package, downloaded from https://github.com/docker/docker-py, but lacked setuptools, downloaded and installed the package did not work. So use this with pip.
This is currently an issue with the dev_appserver bundled in the Cloud SDK. A fix will be out soon. In the meanwhile, your options are:
1) Use gcloud preview app run to run your app when using the Cloud SDK
2) Install the standalone AppEngine SDK (which you already mentioned in your question)
If installing docker-py doesn't work and the stacktrace shows that the error line is:
from docker import docker
Change this line to:
import docker
Source
Jumping on the answer from #Tzach and adding some info.
The file to modify is containers.py
for me it is located here :
C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\docker
If you can't modify it because the file is open in an application, it is in fact that the folder is protected. Just copy/paste the file on your desktop and modify it from there. then copy it back in the original folder.

Python ImportError: No module named - Works in ssh but not in browser

Not sure what the issue is. Works fine via ssh. When viewed in a browser I get a server error. This is know working code that has been migrated to another server / environment.
It can not find a module that is clearly in the directory. Have checked permissions on files and they look ok 755.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
ImportError: No module named xmlproducts
mod_python (pid=16232, interpreter='realtechy.com', phase='PythonHandler', handler='mod_python.cgihandler'): Application error
ServerName: 'realtechy.com'
DocumentRoot: '/var/www/vhosts/realtechy.com/httpdocs'
URI: '/products/myproducts.py'
Location: None
Directory: '/var/www/vhosts/realtechy.com/httpdocs/'
Filename: '/var/www/vhosts/realtechy.com/httpdocs/products/myproducts.py'
PathInfo: ''
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1229, in _process_target\n result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1128, in _execute_target\n result = object(arg)
File "/usr/lib/python2.6/site-packages/mod_python/cgihandler.py", line 96, in handler\n imp.load_module(module_name, fd, path, desc)
File "/var/www/vhosts/realtechy.com/httpdocs/products/myproducts.py", line 6, in <module>\n import xmlproducts
ImportError: No module named xmlproducts
Sounds like the module is not installed properly (or at all). To verify, do the following:
open a shell and start the python shell by typing python
enter the commmand help('modules')
review the list of modules that's returned to see whether xmlproducts is included
if not, then install the module

Categories

Resources