Error while executing custom commands to run python plugin in windows - python

I am trying to install a model management framework over python.
I have python 3.6 and windows 8.1. I was able to successfully install the plugin.
However, when I try to start the visualizer using the studio ui command, I get 'studio' is not recognized as an internal or external command
Most of the resources I have checked online show the installation on linux where this works, how do I get this to work on windows?
Site
Documentation
GitHub
I feel like I am missing something very basic here.

Kind of figured it out.
Apparently setuptools has the provision for specifying entry points. Sample file:
[console_scripts]
mlflow=mlflow.cli:cli
When pip (or another console_scripts aware installer) installs the distribution, it will create a command-line wrapper for each entry point.
So that if we type mlflow on the command line, it is automatically recognized.
So now I am able to run it by running the actual cli.py file with arguments, still need to figure out why this failed on my PC though.
Links: Here, Here and Here

Related

Compiling Python File for Distribution

I have a really simple Python script. It’s written in a single file however I did have to install two things using pip. I’ve created this on Mac and I need to somehow compile it into a runnable application on windows. I’ve spent hours trying to use pyinstaller to make it into an exe file but I don’t think the dependencies are included in that ... I’ve also tried creating a virtual environment using venv but that doesn’t work either. I first tried using pyinstaller on Mac which was really easy but didn’t run at all when transferred it to windows. I then have been trying to do it on windows but it’s just very difficult and it’s just one error after another. I finally managed to build the app on windows using pyinstaller but it said “failed to execute script ...”
So does anyone know any simple way to make it into a runnable application? Doesn’t have to be an exe.
Thanks in advance.
Have you tried using py2app. To install it, type: pip install py2app.
Check out This link for more information.

How to use PyCharm Remote Deployment to develop multiple packages?

PyCharm Professional has a Remote Deployment feature that allows for editing, running and debugging code remotely. This is a powerful feature when writing short scripts and top-level applications that make use of standard or third-party library packages. You can even create a virtualenv on the remote, with all dependency packages installed, and use that to execute the remote program.
However when writing applications that make use of multiple packages that are also developed alongside the application, it becomes necessary to edit packages. Without PyCharm the usual way to do this is with pip install -e . or python setup.py develop, which integrates the source directory with Python's package system, making it possible to edit a number of packages alongside the application.
With a single package, I've found the PyCharm will deploy the package code into its remote workspace, which works OK for debugging if I'm running a script or entry point from within this same package.
The problem I'm having with PyCharm is that it's not clear how to remotely edit and debug multiple packages. Let's say I have a PyCharm project open for one of these packages. When finding references or debugging into code that is in another (yet still developed-by-me) package, PyCharm shows a cached version of the second package (on my local machine). This is fine until I edit the second package on the remote host - after which the cached version is now out of sync and doesn't automatically update. This leads to a mismatch between execution result and debugger/editor state.
There are other quirks too, such as the edited package not actually being installed into the remote's virtualenv.
I haven't been able to find a proper guide to this workflow in PyCharm's documentation, and I'm starting to wonder if I'm either going about this the entirely wrong way, or maybe PyCharm just doesn't support this kind of app+multiple-packages development?

Changing Python path variable in Openshift NodeJS cartridge

I have a NodeJS web server (Express) locally that uses Python-Shell to fire off Python scripts (mostly scraper stuff using PyCurl). The Python scripts also use various modules that I have installed using pip. This all works locally with no issues, running Node v4.1.1 and Python 2.7.10.
Now, I need a server to run this setup on, and I'm cheap, so I really want to use Openshift, which I have used before for other Node-only projects.
My problem is that I need to work with Python, and while it is installed (v2.6 anyway), I can't do much with it. Pip is not installed at all, and I don't have administrative rights to install it. Easy_install seems to be present, but I get permission issues when trying to execute it (even just the test via "easy_install" with no parameters). I need pip to install several modules for my Python scripts.
I was able to follow the instructions here and get Python 2.7, setuptools, and pip all installed successfully, but they are only available by prefixing the path $OPENSHIFT_DATA_DIR/bin (which resolves to /var/lib/openshift/[my-id]/app-root/data/bin). So...
\> $OPENSHIFT_DATA_DIR/bin/python -V
Python 2.7.3
I can also successfully run my Python scripts if I prefix the python command with that path.
So my question is how can I either get python-shell to use that path for Python, or how can I update Openshift's environment variables so that the standard "python" command is pointed to my manually-built v2.7.3 executable?
I'm stumped, but I know next to nothing about Linux or Openshift's architecture specifically, so I'm hoping you guru's out there can help me out!
If someone ever has a real answer to this, feel free to post it up, but I ended up just abandoning Python altogether and re-wrote the scraper in Node using Cheerio. Much better!

Unable to use downloaded third-party library from within PyCharm

I'm working on a script that will plot data onto a map using the Basemap library. I'm trying to import Shapely as well for use in this same script. I'm working with Anaconda2 for Python2.7 in a Windows 7 environment. I used conda install to download the tar.bz2 file from the Conda Packages site (using Windows command line) and it looked like it all installed correctly.
When I open Pycharm and look at my accessible site-packages, I can see this package. However, when I try to use it within my script, I get an error saying that the package does not exist. I ran the script through the debugger to see if it would shed any more light, but I got the same error. Here's a screenshot of my available site packages when I go to Settings-->Project Interpreter from within Pycharm.
Screenshot of PyCharm site packages available
Is there something special I need to do in order to access this package from within a fresh Python file? I was trying to say "import shapely" or "import osx-64-shapely", but both give me the same "package does not exist" error message. I've been able to successfully use other third-party libraries within Python, so I'm not quite sure what the error is here....
I'm new to SO - if you need more details or there's some piece of info I didn't include, please let me know. Thank you for your help!
EDIT: I am NOT asking what the difference is between conda and pip, or how to use pip within PyCharm. I have used both successfully before to install third-party libraries. What I am asking is what might cause a third-party library that appears to have installed successfully from the command line become inaccessible from within PyCharm when I attempt to import it.
I'm not familiar with Shapely but I was astonished to see the name osx-64-shapely as a site-package for your python installation which is in windows 7. Are you sure you downloaded the right file? :)

What is a Framework build of Python?

So I'm testing out the SPy library in Anaconda's Spyder, and have run into a strange error:
SystemExit: This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.
This happens when I try to call the view_cube command from Spectral Python (SPy), which requires wxPython.
I have a feeling that this is related to Spyder's displaying of all the images generated by my program in its onboard console, instead of in independent windows.
How can I fix this error, and is there a way to tell Spyder to display images in their own windows? Can I run a "Framework Build" within Spyder?
EDIT:
I was able to display the resulting images in separate windows by going to Preferences > IPython console > Graphics, and setting Backend to Mac OSX. However, the error when trying to run the view_cube command still persists...
I expect you're using the system version of python that comes installed on mac by default, which isn't a framework build.
You'll want to install a version of python from python.org which are all framework builds. I expect you'll want the latest version of python 2. You will also have to install your dependancies again against this new python install.

Categories