<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Enrique Catala on Medium]]></title>
        <description><![CDATA[Stories by Enrique Catala on Medium]]></description>
        <link>https://medium.com/@enriquecatala?source=rss-ac64ae6bbe5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IscDVZe-0hyZBWglB8aDKw.jpeg</url>
            <title>Stories by Enrique Catala on Medium</title>
            <link>https://medium.com/@enriquecatala?source=rss-ac64ae6bbe5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:14:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enriquecatala/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[fastapi-ai-template]]></title>
            <link>https://medium.com/@enriquecatala/fastapi-ai-template-c46a8c5ed3fc?source=rss-ac64ae6bbe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c46a8c5ed3fc</guid>
            <category><![CDATA[spacy]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Enrique Catala]]></dc:creator>
            <pubDate>Tue, 25 Oct 2022 21:18:57 GMT</pubDate>
            <atom:updated>2022-10-25T21:18:57.095Z</atom:updated>
            <content:encoded><![CDATA[<p>FastAPI is a great choice in order to deploy RESTApi with python. Its fast, easy and powerful, and something to check if you work deploying AI models for real-time inferencing in kubernetes.</p><p>I made a “<em>production ready</em>” template for FastAPI that you can use to deploy your own AI models.</p><h4>Whats included?</h4><p>With <a href="https://github.com/enriquecatala/fastapi-ai-template/">this template</a> you will find a very easy way to create a full template that covers the following:</p><ul><li>Telemetry: ApplicationInsights ready</li><li>Security: Security through API key</li><li>Webserver: gunicorn configuration to fine tune threads and memory</li><li>Docker support: Dockerfile and docker-compose setup</li><li>Debug: visual studio code debug configuration setted up</li></ul><h4>Cookiecutter template</h4><p>You don´t need to fork this project. This project is a template for cookiecutter that can be <a href="https://github.com/enriquecatala/fastapi-ai-template/tree/main#setup">used directly from your command line without forking it</a>. The output of this project is a fully configured FastAPI application ready for you to start coding and deploy.</p><h4>Setup</h4><p>Since this is a template for cookiecutter, you need first to <a href="https://cookiecutter.readthedocs.io/en/latest/installation.html">install cookiecutter</a>.</p><p>Once <a href="https://cookiecutter.readthedocs.io/en/latest/installation.html">installed</a>, you can run the following command to create a new project:</p><pre># go to the directory where you want to create the project<br>cd ~<br>mkdir your-project<br>cd your-project<br># create your project using this template<br>cookiecutter <a href="https://github.com/enriquecatala/fastapi-ai-template.git">https://github.com/enriquecatala/fastapi-ai-template.git</a> \<br>             -v \<br>             --directory=&quot;base-template&quot;</pre><p>This will create a base ApiREST project ready for you to test and deploy. It will include a <em>test method</em> that you can use to test your code.</p><pre>docker compose build<br>docker compose up</pre><p>Now navigate to <a href="http://127.0.0.1:5000/docs">http://127.0.0.1:5000/docs</a> to see the documentation.</p><h4>Configuration</h4><pre>your-project/<br>├── fastapi-ai-template/  &lt;--------- Project template <br>    └── .vs-code/         &lt;--------- visual studio debug config <br>        ├── launch.json        <br>        └── tasks.json<br>    └── app/              &lt;--------- Project folder <br>        ├── api/          &lt;--------- api routing<br>        ├── core/         &lt;--------- event handling and security<br>        ├── models/       &lt;--------- Model classes definition<br>        ├── services/     &lt;--------- API main methods (this is where you have the main logic)<br>        └── main.py<br>    ├── Dockerfile <br>    ├── docker-compose.yml <br>    ├── gunicorn_conf.py  &lt;--------- web server config<br>    ├── requirements.txt  &lt;--------- default libraries<br>    └── ...</pre><h4>Help!</h4><p>Please if you think this worth the effort, consider ❤️ <a href="https://github.com/sponsors/enriquecatala">Sponsor this project</a> and help me increase functionality</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c46a8c5ed3fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset]]></title>
            <link>https://medium.com/@enriquecatala/java-io-filenotfoundexception-hadoop-home-and-hadoop-home-dir-are-unset-4004d5e05f67?source=rss-ac64ae6bbe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4004d5e05f67</guid>
            <category><![CDATA[setup]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[spark]]></category>
            <dc:creator><![CDATA[Enrique Catala]]></dc:creator>
            <pubDate>Sat, 28 May 2022 11:57:27 GMT</pubDate>
            <atom:updated>2022-05-28T11:57:27.458Z</atom:updated>
            <content:encoded><![CDATA[<p>As a Data Engineer I´m using WSL2 to run my Linux and dev station (python, scala,…), because I really like the Windows OS and also the Linux kernel and the OpenSource software and community. The thing is that there is an annoying problem with windows and spark when you try to run a spark job in windows (no matter if like me, you are using docker to run your spark local cluster).</p><p>If you want to run a spark job in windows that make use of the spark SQL pool, you need to set the <em>HADOOP_HOME</em> environment variable manually because if you don´t you will receive a crash like this:</p><pre>java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset</pre><p>There is a very quick fix for this:</p><ol><li>Go and clone this repo: <a href="https://github.com/cdarlint/winutils">https://github.com/cdarlint/winutils</a> in your Windows machine.</li></ol><blockquote>NOTE: I recommend you to clone the entire repo because doing that you will be able to use any version of winutils.exe</blockquote><p>2. Set HADOOP_HOME environment variable to the root path of your version, depending on the scala version you are using</p><p>3. Add to the PATH environment, the %HADOOP_HOME%\bin</p><pre>cmd&gt; HADOOP_HOME=&lt;your local hadoop-ver folder WITHOUT ‘bin’&gt;<br>cmd&gt; PATH=%PATH%;%HADOOP_HOME%\bin</pre><blockquote>NOTE: For more info please read <a href="https://cwiki.apache.org/confluence/display/HADOOP2/WindowsProblems">this</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4004d5e05f67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Work locally with Azure Machine Learning from docker images]]></title>
            <link>https://blog.devgenius.io/work-locally-with-azure-machine-learning-from-docker-image-2c2e6884a3e8?source=rss-ac64ae6bbe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c2e6884a3e8</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure-machine-learning]]></category>
            <category><![CDATA[docker-compose]]></category>
            <dc:creator><![CDATA[Enrique Catala]]></dc:creator>
            <pubDate>Wed, 12 Jan 2022 16:58:11 GMT</pubDate>
            <atom:updated>2022-01-16T11:52:48.755Z</atom:updated>
            <content:encoded><![CDATA[<p>When you work with Azure Machine Learning, you are not required to work with Azure Machine Learning portal. Since Azure Machine Learning libraries support to work connected with your workspace through the official library, you can benefit from containers to create an entire dev container to develop and deploy your code into Azure Machine Learning Service.</p><p>I´ll use the official labs for the <a href="https://docs.microsoft.com/en-us/learn/certifications/exams/dp-100">DP-100</a> exam (<em>Exam DP-100: Designing and Implementing a Data Science Solution on Azure</em>). If you are preparing for this exam, one of the best things you can do to really practice is to work locally and play with a mixed<em> onprem/cloud</em> strategy. This not only will help you a lot on preparing your exam but also will help you on preparing for the real world :)</p><p>In this post, I´m covering how to deploy the <a href="https://github.com/MicrosoftLearning/mslearn-dp100">mslearn-dp100</a> repository and be able to work with AzureML from inside a container in your laptop.</p><h3>Fork the official DP-100 git´s repository (optional)</h3><p>Since we will be using git submodules to track the <a href="https://github.com/MicrosoftLearning/mslearn-dp100">official´s dp-100 repository</a>, you don´t really need to fork it on your own GitHub account. Why then? Well, because decoupling your submodule from the main repository will help you to avoid breaking changes from the main repository.</p><blockquote>Public clone the <a href="https://github.com/MicrosoftLearning/mslearn-dp100">mslearn-dp100</a> to avoid breaking changes on your side</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*pFkVj4N-HhhZz5_SZPqmxw.png" /></figure><h3>Create your own git repository</h3><p>Now it´s time to prepare your repo. Personally, I always prefer to add the “<em>-practice</em>” suffix to the official repository name, but this is up to you.</p><figure><img alt="create repository" src="https://cdn-images-1.medium.com/max/724/1*FzxSlMVl1xBqTt2DEKCJuw.png" /><figcaption>You can make this repo private since we will be using submodules pointing to official repo</figcaption></figure><p>Now it´s time to clone the new repo into your own machine.</p><figure><img alt="gh repo clone enriquecatala/mslearn-dp100-practice" src="https://cdn-images-1.medium.com/max/612/1*OEqmvQywjycE_Vvw8NnjLg.png" /></figure><h3>Create a submodule to the forked mslearn-dp-100</h3><p>Since we want to play and learn with the official labs, we of course will be modifying and breaking things. One of the best ways to isolate our changes and still be able to add our own artifacts is to get a <em>submodule </em><strong>from our fork</strong>. That way, we will be able to delete/create/modify files, and still be able to push changes and get the latest versions from the official repository (if needed)</p><p>To do so, you can simply call the git submodule command:</p><pre><em>git submodule add </em><a href="https://github.com/enriquecatala/mslearn-dp100"><em>https://github.com/enriquecatala/mslearn-dp100</em></a><em> mslearn-dp100</em></pre><p>After doing that, you will find that the folder <strong>mslearn-dp100</strong> has been added to your project, with the content of your forked official repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*hMksVHtKP5R96XpSnJUA3A.png" /><figcaption>mslearn-dp100 is now a submodule on your repository</figcaption></figure><p>Time to commit :)</p><p>At this point, you will have a link to your forked mslearn-dp100 repository inside a folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*tNlxflibTp3gN_cLE9V5Mg.png" /><figcaption>mslearn-dp100 inside your repository</figcaption></figure><p>Nice, but…why? Well, this has been done for a good reason…to decouple not only the main repository but also our docker images :)</p><h3>Create the container to work with AzureML</h3><p>Containers are a very powerful resource that you MUST know. If you don&#39;t know what containers are and how to use/deploy them, please learn and try to master this technology in order to be the professional you deserved to be.</p><blockquote>NOTE: no matter the path you are following with computers (engineering, science,…), GO AND MASTER <a href="https://www.docker.com/resources/what-container">CONTAINERS</a></blockquote><p>Now we are going to create a docker image with all the software and libraries required to work with AzureML. Why? because we don&#39;t want to install everything in our machine, as simple as that.</p><blockquote><strong>Pre-requisite:</strong> The only pre-requisite here is a container daemon to create and deploy the image we are working here. There are a few of them, but the most easy to start playing is <a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a></blockquote><p>In this post I don´t want to go deeper in how to create a container, so please go and copy/paste the content of this file and named <strong>azureml.dockerfile , docker-compose.yml </strong>and <strong>requirements.txt</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14bd7d6ac65914f0cd600074e5eab672/href">https://medium.com/media/14bd7d6ac65914f0cd600074e5eab672/href</a></iframe><blockquote>NOTE: If you don&#39;t understand what are we doing here, please go and learn about containers. You deserve it</blockquote><p>The <strong>azureml.dockerfile</strong> and <strong>docker-compose.yml</strong> do the following:</p><ul><li>create a non-root container named <em>mslearn-dp100-practice</em></li><li>Install all the <a href="https://docs.microsoft.com/en-us/python/api/overview/azure/ml/?view=azure-ml-py">azureml python libraries</a> among other ones</li><li>Deploy conda</li><li>Deploy jupyter notebook in port 8888</li><li>Mount the mslearn-dp100 submodule inside the container (this will allow you to work from your local jupyter notebook inside the container)</li></ul><p>The <strong>requirements.txt </strong>contains the python libraries required in order to work with all labs in the mslearn-dp100 solution</p><p>At this time, your project will be like this:</p><figure><img alt="project files in root directory" src="https://cdn-images-1.medium.com/max/357/1*xGG783IvWD7nXYTy9UBKjA.png" /></figure><h3>Compile the image</h3><p>Now that you have the docker-compose prepared, it´s time to build the container:</p><pre>docker compose build</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*EeoVYtts0kefrUgJuokXDA.png" /><figcaption>Build the image can take several minutes depending on your machine</figcaption></figure><blockquote>NOTE: Please remember that we are not going to install anything locally. We are using containers :)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*8EitHz-oJ23OdDHhgDQOxg.png" /><figcaption>If everything went fine, this is what you should see</figcaption></figure><h3>Connect to your jupyter notebook and start playing</h3><p>As soon as your image has been built, you are prepared to start the container and connect to it:</p><pre>docker compose up<br># go to the line showed in the output of the command <a href="http://127.0.0.1:8888/?token=">http://127.0.0.1:8888?token=</a>XXXXXXXX</pre><blockquote><strong>NOTE</strong>: We configured port 8888. If you want to change that port, go to docker-compose.yml and change the “port” tag</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*xKy-C1fe6SCtdnf1H4QuIA.png" /><figcaption>The url to connect is the one on the last message</figcaption></figure><p>Navigate to the url:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*ajQ4CzVrkYLKijb3Dc9uKQ.png" /></figure><p>So you are now basically connected to a jupyter notebook inside your container.</p><blockquote>Now you have all the python libraries and software required to work locally with AzureML</blockquote><h3>Add your AzureML workspace to your repo</h3><p>As soon as try to execute any of the laboratories you will find that since your workspace is not instantiated, you are going to be stucked with the following error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*lBO9v6Y4bHeBXV7Fp23qCg.png" /><figcaption>config.json is not found</figcaption></figure><p>When you want to work with AzureML and use the Azure resources, you need to include the workspace properties:</p><ul><li>subscription_id</li><li>resource_group</li><li>workspace_name</li></ul><p>These properties can be found in your Azure Machine Learning resource</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*n8hKp_D62S3_nWMzBZVe8A.png" /><figcaption>the three parameters can be found here</figcaption></figure><blockquote><strong>NOTE</strong>: For more info, check <a href="https://azure.github.io/azureml-cheatsheets/docs/cheatsheets/python/v1/workspace/">this</a></blockquote><p>Then, to connect to your azure machine learning workspace you only need to include a <em>config.json</em> file like this one</p><pre>{<br>  &quot;subscription_id&quot;: &quot;YOUR SUBSCRIPTION ID&quot;,<br>  &quot;resource_group&quot;: &quot;dp-100&quot;,<br>  &quot;workspace_name&quot;: &quot;dp100&quot;<br>}</pre><p>This is optional but recommended: Please make sure you include <em>config.json</em> file into your <em>.gitignore</em> file for security reasons</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*rSiX5U5bV5UBHRoUlAl57w.png" /><figcaption>include config.json into .gitignore</figcaption></figure><p>Finally, since you configured the workspace, next time you want to instantiate the Workspace you will be able to connect to your Azure Machine Learning service, right from inside your container:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*Qch3SDlfcNJmrhW394O3XQ.png" /><figcaption>finally integrated your container with your azure machine learning service</figcaption></figure><h3>Drop a submodule</h3><p>If by accident you added the wrong submodule URL to your repo, the following actions will help you to clean up the submodule from your repo:</p><pre>1. git submodule deinit -f -- a/submodule<br>2. rm -rf .git/modules/a/submodule<br>3. git rm -f a/submodule</pre><blockquote>For more info go <a href="https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial#Removal">here</a></blockquote><h3>Repository of this post</h3><p>The repo of this post can be found <a href="https://github.com/enriquecatala/mslearn-dp100-practice">here</a></p><p>This is all for now. Feel free to comment or <a href="https://www.linkedin.com/in/enriquecatala/">connect with me</a> if you have any questions on this article. Also, let me know your comments or feedback.</p><p>Thanks for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c2e6884a3e8" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/work-locally-with-azure-machine-learning-from-docker-image-2c2e6884a3e8">Work locally with Azure Machine Learning from docker images</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>