On masks and SARS-CoV-2

This comment was initially a response to a youtube video from Tech Ingredients – a channel I have in the past thoroughly enjoyed for their in-depth dive into scientific and engineering aspects of various heavy on engineering DIY projects. Unfortunately, I am afraid that panic around COVID19 has prevented a lot of people from thinking straight and I could but disagree with the section on masks.


Hey there – Engineer turned biomedical scientist here. I absolutely love your videos and have been enjoying them a lot, but I believe that in this specific domain I should have enough experience to point out what appears to me as overlooked and is likely to chase drastically your recommendation on masks.

First of all, the operation room masks and the standard medical masks are extremely different beasts – if anything their capacity to filter out small particles, close in size to droplets transporting COVID19 at the longest distance is much closer to N95s than those of standard medical masks:

masks filtration efficiency

The standard medical masks let through about 70% of droplets on the smaller end of those that can carry SARS-CoV-2. A decrease in exposure of such magnitude has not been associated with a statistically significant reduction in contagion rates in any respiratory transmitted disease.

So why are standard medical masks recommended for sick people? The main reason for that is that in order to get into the air, the viral particles need to be aerosolized by coughing/sneezing/speaking by a contaminated person. The mask does not do well at preventing small particles from getting in and out, but it will prevent, at least partially the aerosolization, especially for larger droplets – that will contain more viruses and hence be more dangerous.

Now, that means that if you really want to protect yourself, rather than using a mask, even surgical, it’s much better to use a full face shield – while useless against aerosolized particles suspended in the air, it will protect you from the largest and most dangerous droplets.

Why do medical people need them?
The reality is that without the N95 masks and in immediate contact with the patients, the risk of them getting infected is pretty high even in what is considered as “safe” areas – as well as passing the virus to their colleagues and patients in those “safe” areas. If let spreading, due to the over-representation of serious cases in the hospital environment, it is not impossible that the virus will evolve to forms that lead to more serious symptoms. Even if we can’t protect the medical personnel, preventing those of them who are asymptomatic from spreading the virus is critical for everyone (besides – masks are also for patients – if you look at pictures in China, all patients wear them).

Second, why did WHO not recommend the use of N95 masks to the general public at the beginning of this outbreak, whereas they did that for SARS-CoV in 2002-2004 outbreak almost as soon as it became known to the West?

Unlike the first SARS-CoV, SARS-CoV-2 does not remain suspended in aerosols for prolonged periods of time it does not form clouds of aerosolized particles that remain in suspension and can infect someone who is passing through the cloud hours after the patient who spread it left. For SARS-CoV-2, the droplets fall to the ground fairly rapidly – within a couple of meters and a couple of minutes (where they can be picked up – hence hand washing and gloves). Due to that, unlike SARS-CoV, SARS-CoV-2 transmission is mostly driven by direct face-to-face contact with virus-containing droplets landing on the faces of people in direct contact.

Situation changes in hospitals and ICU wards – with a number of patients constantly aerosolizing, small particles do not have the time to fall and the medical personnel is at less than a couple of meters from patients due to the place constraints. However, even in the current conditions, the N95 masks are only used in the aerosol-generating procedures, such as patient intubation.

Once again, for most people, face shield, keeping several meters of distance and keeping your hands clean and away from your face are the absolute best bang-for-buck there is with everything else having significantly decreasing returns.


PS: since I wrote this paper, a number of science journalists have done an excellent job at doing in-depth research on the subject and write up their findings in an accessible manner:

In addition to that, a Nature study has been recently published, indicating that while masks are really good at preventing large droplets formation (yay), when it comes to small droplets formation (the type that can float for a little bit), it’s not that great for Influenza. The great news is that for Coronavirus, since there are few droplets of that size formed, it works great and containing any type of viral particles emission: Nature Medicine Study.

(Anti-) Marie Kondo

For Christmas, my GF decided that the best thing to do was to offer me the coming about tidying up from Marie Kondo. You know, the inspirational TED speaker that converted from helping people to de-clutter their apartments to helping them with cluttering them with useless things, such as crystals.

Beyond the pure and brutal irony of selling magic crystals after having gained fame helping people to get rid of things they didn’t need, my main issue with her approach is that she sees tidying up as a single-off effort rather than a process.

The issue with that it has an insane activation barreer for people who actually want to clean up (aka “I will never start because I need a lot of time to do this and I don’t have it”) and given the amount of work, people are likely to run out of steam and loose motivation before it’s done.

Instead of that, I am more in favor of the “steel milling approach”. If you try to remove all the unwanted steel while cutting a piece, you will cut too deep and break the machining bit. Instead, you need to do a multitude of passes, each of which removes some unwanted steel, revealing the piece level by level.

I have been quite often told that I am tidy and that I keep my apartment in good order. So here is my take on the matter (as a bonus, without any attempts to start a sect or sell you that having a clean apartment will change your life and bring in the perfect partner into your life).

As many things that I’ve seen working out in the long run, this approach is not motivated by the final result but instead is about developing a process that will be ongoing. Instead of focusing on the goal, it should be a focus on the process, the daily and weekly actions to tidy up and to maintain the tidiness.


Realistically, for those of us leaving in insane climates or not having the money to buy clothing we like, the “does it bring joy” characterisics is more of a meme than anything else. Some clothes are not the best, but that’s the one we have right now and what point is there to spend more money to get something that is not guaranteed to be better or more satisfying in the long run?

I suggest instead the MMORPG approach. You have a set or two appropriate for environments that you encounter often. For instance winter, interseason, summer, running, skiing. You have slots onto which gear goes. Shoes, socks; pants, underwear; on-body layer, intermediate layer, second intermediate laye, top layer; gloves, scarf, headchief. Depending on how frequently you wash your stuff and how long you need to go without washing, you need a number of items to cover the slots between laundries. And that’s basically it. You don’t go above it, except for maybe 1 or two items for safety; you replace as soon as you don’t need them anymore.

For leather shoes, it’s a good idea to have 2-3 pairs and rotate to prevent usage. Simialrly, for shoes it makes sense to make a better investment for better quality and perform sole repairs to extend their lifespan. It’ll be cheaper in the long run and as a bonus you won’t have to break your shoes in over and over again.

Don’t fold your outer/intermediate layer cloths; hang them if you have space. It’ll allow the anti-moth products to better permeate them; for them to dry if they are still slightly dampened and will make it easier to see their state when you are looking at them. The only exception for me are running cloths because of how thin they are.

Put away off-season clothing (ski gear in summer; shorts in winter) as well as items that you use rarely (bedding for guests) away, preferably vaacuum-compacting them and adding some anti-mite paper (yeah, those are super annoying to get rid of and can fly in during the warm months). For fancy clothing, it also makes sense to have a hanging insulation, to avoid too much friction to them. Bonus – putting them away after laundry doesn’t take nearly as much time as in case folding was needed and hence will happen faster and with strain on your brain.

You can totally wash colors and whites together and dry them together, provided you throw in a color absorbent lingette.

Beware of what you buy, because you will be storing it.

Have a separate bin for dirty and lcean clothing.


This one is easy. Those you need to keep, for instance for return policy, insurance, contracts or contestation with banks, put them in a plastic pocket and into a binder.

Better even – scan them so that you have index of things; keep just ones you need in the original.

Leave those you need to process out, on a table. Seeing them there will annoy you into processing them ASAP. DO NOT PUT THAT OFF. Beter – designate a day of week when you need to get them done.

Small stuff:

That one is hard. Decoration should go into the place they are supposed to go.

Those rather small items that you need some time should be stored in boxes or drawers. Otherwise they will accumulate dust.

Memorabilia from the past should be stored in folders and boxes and be put away as well.

General principle of storage is the same as in computers.

What determines what is stored where is the time you need to access/store it and frequency. The more often you need things, the more easily accessible they should be. For some things, it often doesn’t make sense to buy them – renting will be cheaper and the absence of clutter will feel great.

Besides, my biggest beef with Marie Kondo is ion the concept of joy. The life is not all about joy. Some of your items don’t bring joy, but they are important reminders to yourself or are highly functional. For instance, winter anti-slip boots you need twice a year, ugly AF, but you are happy that you have them when you need them.

Overall, there is a balance to be found between order and chaos. Too orderly and it looks like a prison cell or a hospital. Too chaotic and it looks like a dumpster. While in Japan, the super-clean aesthetic of Sama-Zama is considered as a reference, for most westerners, it is too clean and sterile. A balance between the order and the chaos is to found and struck, that is personal to everyone.

Energy and Co

Now that we have covered the basics, let’s go to the pseudo-guru stuff of energy. Marie Kondo actually seems to know nothing about the energy of the items or that it differs significantly between people and cultures.

This is due to the fact that the energy might not exist – our minds treat it as existing and use it to better interface with unconscious.

For instance, the resting cloths trick is something my grandfather taught me when I was five, so that I would put cloths into order when going to bed. And I can guarantee that if you imagine yourself in the place of your cloths, resting on a chair or hanging in a straight position is much better than being folded with several folds.

Similarly, covering the heads of the plushie toys or the photos in order to avoid the eyes is the stuff of nightmares – reminding of worst horrors of prisoners/civilians executions. You need to face your decisions. Besides, toys are better off donated to find a new life and photos are better shredded and taken by the river of time to the past they belong to.

More problematic to me is the concept of having to leave things behind to move forwards. As we advance in life, we accumulate memories. Some of them joyful, some bitter-sweet, some nostalgic, some brining on the reflections. Trying to clear them all just to move forwards will get us only to sterile rooms; without past or future; without a personality or wisdom to speak of.

Don’t discard things that forged you or that give you glimpse into your past self. They define you and make who you are. They’ll help you to make sense of your past and guide you forwards.

As you age, you will be walking into the valley of the memories of ther life well-lived; lessons learned and emotions lived – all that made you alive; and all that will allow you to face death, when the time comes, without fear or regret.

You’ve poured energy and life in order to craft the artifacts; sometimes on purpose, sometimes on accident. They are yours to give it back to you in times of need now – it makes but sense to keep them and keep them exposed to yourself.

What I’ve learned after recording every single transaction for a year

After a couple of years watching my finances not faring as great as I was expecting them to, I’ve finally decided to go beyond the usual “just stop doing X” internet advice and the basic analysis capacities the most common accounting platforms provided.

To do so, I did something called analytical accounting. For every transaction, I was splitting it into meaningful categories (Groceries:Staples, Groceries:Dairy, Groceries:House Cleaning, …) and assigning a tag for them, that was explaining why that expense took place. An example of such tag can be proc_daily_burn – for most basic groceries or proj_moving_houses – for a project moving between houses or proc_relationship_X for drinks/dining out that I did to go out and see a friend. I’ve also recorded what I was paying for someone when I was inviting them out, but also when someone was inviting me to have a more global view of my expenses.

Here is what I’ve learned:

  • Don’t pay for dates/partners if they aren’t paying similarly.

  • Car is expensive AF, train – pretty much as well; carsharing is the best

  • Dining out creeps up really fast and alcohol – drank out or at home builds up to cost impressive amounts of money really fast.

  • Of all sports, skiing is most expensive, followed by swimming (mostly pool and trainer), whereas running by yourself is shockingly effective, despite the shoes price.

  • Car is fucking expensive, especially when renting is involved. trying to off-set it by car-sharing is pretty hard and often doesn’t work at all. That being said, per month, my rental expenses are comparable with the price of just owning a car in Switzerland – before repairs or gas.

  • I should stop going out with friends with whom I spend too much in one sitting and try to do more of the outings where I spend little for huge amounts of enjoyment. Which means friends who drink a lot and eat at expensive restaurants.

  • Similarly, the bang for buck of doing a party at home and cooking for it is significantly higher than the one of eating out.

  • Fanciness is about the last thing I need in my life at this stage. Dress watch, picking up bills for friends when going out, offering car rides/help for free when out with friends comes naturally, but if the favor is not regularly returned, it doesn’t make sense to keep going. Similarly, trying to collect wines – expensive or too many of them is expensive and brings little joy for the cost associated with it. In all hobbies, there is a point of diminishing returns, it makes no sense to go beyond it.

  • My godfathering is an excellent example of massive enjoyment/meaningfulness for a relatively limited price. Along with my relationship with my current GF and the visit to Paris with a friend of mine who loves running and was stopping on her way from SF.

  • The amount of catching up to do when you move in with basically nothing to a new country is massive. I am not yet done and it did cost me just shy of 3k.

  • Healthcare in Switzerland is expensive AF, but still a tiny amount compared to the US.

  • I am fortunate to have a housemate to split rent with and to count on if I mess up my accounting.

  • Debt snowballs fast. I ended by paying 3k total that was due to debt to banks. About 700 in interests, 800 in exchange rates and about 1k in service charges (paying with the wrong card, going over the limit, …), on top of the standard 380 that I was supposed to pay to the banks for keeping my accounts going. Basically 10x due to debt.

Now, when to looking where to save in a year:

  • take the car as little as possible, going with carshare whenever possible, especially when going to my parent’s city.
  • with less travel for leisure, there should be as well a bit less expenses
  • when traveling, at least maximize for memorability for a given price.
  • stopping going out with friends and GF so much, not eating and drinking as much as them and not picking up the bill will help tremendously.
  • stop being fancy with wines and beers is another great way of saving.
  • keep out of debt, above all else

What I learned about accounting:

  • forcing yourself to write down expenses is hard in the long run; it gets easy as soon as you do less of the expenses you are unhappy about and start seeing it as a “where do I stand/how much can I afford to spend this month after I pay all the bills” kind of tool.
  • tags are insanely powerful but require thinking about what to put in them and some planning forwards/re-tagging. In my case, it ended up being process/project – main motivation + location. Yet remembering the specific spelling of tags is far from evident. Splitting is uneasy and leads to cross-contamination as well, given it’s not always possible to put tags on the splits of the main expense.
  • performing categories splitting as well as tags/owners is hard – you need to know in advance what kind of analysis you will want to do and keep it highly consistent.
  • writing the meaningful messages as to “whom” you paid something is really helpful as well.
  • what you have an impression you’ve spent on vs what you really did spend on have little to do one with another. You tend to forget small recurring expenses and instead focus on the big one-off ones, memorable because you gnashed your teeth while paying for them (just after a big resolution, a high fraction of your available money at that time), whereas a steady flow of smaller ones or intermediate ones tends to fly under the radar.
  • just as with the weight gain, it’s hard to see what leads to accruing debt – where the previous poor decision ends and a more recent one starts

Overall remarks:

Just with the weight loss, it is easy to find yourself with an impression that you are having a lot of money at your disposal and start spending it only to realize it flies away way too fast and that you’ve wasted it all but forgot about an important recurring charge/planned charge.

Alcohol specifically: with regards to groceries, there were two major spikes – one for the wine fair, one for my trip to Avignon and Chateau-Neuf de Pape. For dining out, there is a noticeable spike with a childhood friend in January, that I was seeing for the first time in years, and another one while my ex was visiting from the US for a month. The consumption dropped drastically after September analysis of where my money was going and once I was no more in travels/visiting friends.

Project-wise, the ones that were the most imposing were my ex’s visit (4.5k), followed by the Interrail trip across central Europe(2.5k) – which is insane considering the difference in duration, location, and excitement between the two; followed by furnishing a new apartment (1.9k), with Christmas coming on the tail (1.4k), a trip to Portugal with the lab (1k), smartwatch (1k), Paris with the US friend (360), skiing equipment, watches, pure move to Bassenges (700), fine wines (650), Skiing with Fred (650), move with my friend into his appt right after coming back from the US (580), Avignon to see a high school friend, (566), Audio equipment (561), skiing with dad (469), with Madrid with my GF being surprisingly cheap (350), about the level of Strasbourg visit with an average at 312, on par with the WEs with Nat in Strasbourg (cherry+October) and slightly below WEs in Switzerland (~200) with thermometers clocking in around 500 (BBQ is an expensive hobby after all…).

Relativism is toxic – some expenses are high, but it doesn’t mean you should consider burning off a fraction of them on small things that are no biggie.

To fight it, defining a base amount (as for instance my favorite Nepalese in Baltimore) and every time you make an expense, ask yourself if you are going to get more pleasure from that expense than from the base amount. Whether the expected trade-off is worth it. You’ll develop a keen sense of what is worth what to you.

Adjusting the sense of what is an acceptable expense – aka overcoming the legacy of brokenness and a sharp lack of money. You need to get physically uncomfortable with not having more room/not having more savings to avoid compensating for things you didn’t buy for yourself as well as the frustration of the lack of money from all those years.

But perhaps, most importantly, the devil is in the details. your memory is imperfect and does not register daily groceries, you buy almost every day for 5-10 euros as anything significant and yet it adds up to 300 – a plane ticket you would have definitely remembered.

Scale-Free networks nonsense or Science vs Pseudo-Science

(this article’s title is a nod to Lior Pachter vitriolic arc of 3 articles with similar title)

Over the last couple of days I was engaged in a debate with Lê from Science4All about what exactly science was, that spun off from his interview with an evolutionary psychologist and my own vision of evolutionary psychology in its current state as a pseudo-science.

While not necessarily always easy and at times quite movemented, this conversation was quite enlightening and let me to trying to lay down

Following the recent paper about scale-free networks not being that spread in the actual environment (that I first got as a gist from Lior Pachter’s blog back in 2015) helped me to formalize a little bit better what I believe I feel a pseudo-science is.

Just as the models and theories within the scientific method itself, something being a scientific approach is not defined or proved. Instead, similarly to the NIST definition of random numbers through a series of tests that all need to be successfully passed, the definition of a scientific approach is a lot of time defined from what it’s not, whereas pseudo-science is defined as something that tries to pass itself as a scientific method but fails one or several tests.

Here are some of my rules of thumb for the criteria defining pseudo-science:

The model is significantly more complicated that what the existing data and prior knowledge would warrant. This is particularly true for generative models not building on the deep pre-existing knowledge of components.

The theory is a transplant from another domain where it worked well, without all the correlated complexity and without justifying that the transposition is still valid. Evolutionary psychology is a transplant from molecular evolutionary theory,

The success in another domain is advanced as the main argument for the applicability/correctness of the theory in the new domain.

The model claims are non-falsifiable.

The model is not incremental/emergent from a prior model.

There are no closely related, competing models that are considered upon application to choices.

The cases where the model fails are not defined and are not acknowledged. Evo psy – modification of the environment by humans. Scale-Free networks.

Back-tracking on the claims, without changing the final conclusion. This is different with regards to affining the model where the change in the model gets propagated to the final conclusion and that conclusion is then re-compared with reality. Sometimes mends are done to that model for it to align with the reality again, but at least during a period, the model is still considered as false.

Support by a cloud of plausible, but refuted claims rather than a couple of strong, hard to currently attack the claims.

The defining feature of pseudo-science however, epsecially compared to the faulty science is its refusal to accept the criticism/limitations to the theory and change its prediction accordingly. It always needs to fit the final maxim, no matter the data.

Jupyter/Ipython notebooks

After writing it down a couple of weeks ago for Hacker News, here is the recap and some updates:

I am a computational biologist with a heavy emphasis on the data analysis. I did try Jupyter a couple of years ago and here are my concerns with it, compared to my usual flow (Pycharm + pure python + pickle to store results of heavy processing).

  1. Extracting functions is harder
  2. Your git commits become completely borked
  3. Opening some data-heavy notebooks is neigh impossible once they have been shut down
  4. Import of other modules you have in local is pretty non-trivial.
  5. Refactoring is pretty hard
  6. Sphinx for autodoc extraction is pretty much out of the picture
  7. Non-deterministic re-runs – depending on the cell
    execution order you can get very different results. That’s an issue
    when you are coming back to your code a couple of months later and
    try to figure what you did to get there.
  8. Connecting to the ipython notebook, even from the environments like Pycharm is highly non-trivial, just as the mapping to the OS
  9. Hard to impossible to inspect the contents of the ipython notebook when it’s hosted on Github due to the encoding snafus

There are likely work-arounds for most of these problems, but the issue is that with my standard workflow they are non-issues to start with.

In my experience, Jupyter is pretty good if you rely only on existing libraries that you are piecing together, but once you need to do more involved development work, you are screwed.

How to upgrade MediaWiki – approximate 2018 guide

Unfortunately, unlike WordPress, MediaWiki doesn’t come with a single-button update version. Perhaps because of that, perhaps because of my laziness, I have been postponing my updates of Wikimedia websites for over five years by now. However, in the light of recent vulnerability revelations, I have finally decided to upgrade my installations and started trying to figure what exactly I needed, given I only have web interfaces and FTP access to the website I manage.

First of all, this link gives a good overview of the whole process. For my specific case, I was upgrading to the 1.30, which required a number of edits to the config file, explained here. Now, what seemed to be happening was that after backing up my database (done for me by my hosting provider) and files (that I could to by FTP), I just needed to copy the files from the latest release version (REL1_30 in my case – DO NOT DO IT, see edit below) and copy it to the directories via FTP and then just run the database update script at wiki.mywebsite.org/mw-config/. Seems pretty easy, right?

Nope, not so fast! The problem is that this distribution does not contain a crucial directory that you need to run the installation and without which you wiki installation will fail with a 500 code without leaving anything in the error logs of the server.

This step isn’t really mentioned in the installation guide, but you actually need to remove the existing /vendor folder in your installation over FTP, build the latest version for your build with a git clone https://gerrit.wikimedia.org/r/p/mediawiki/vendor.git into a /vendor folder on your machine and then upload the files to your server.

Only after that step can you connect the /mw-config/ and finish upgrading the wiki.

So yeah, let’s hope that in a not-so-distant future MediaWiki would have the same handy ‘update now’ button as the WordPress. Because something is telling me that there are A LOT of outdated MediaWiki installs out there…


After spending a couple additional hours dealing with additional issues: do not use the “core” build, but instead download the complete one, including all the skins, extensions and vendor files from here.

Recommendation engine lock-in

Youtube’s recommendation engine, at least in my experience, has three modes:
– Suggest the channels of which I’ve already watched the content:
– Suggest me the content I’ve already watched to watch again
– Suggest me the new updates on the playing lists of which I’ve already watched several videos

Unfortunately, while it works very well when I’ve just discovered a new couple of channels and have their content chosen and pushed to me, it fails to deliver the experience of discovery – it’s overfitting my late preferences, locking me in into the videos similar to what I have watched instead of suggesting me new content and new types of content I might be interested in. And seen that I also experience the same problem with the Quora’s recommendation engine (a couple of upvotes and all of my feed is almost exclusively army weapon tech).

I feel like the recommendation engine creators should abandon their blind faith into general algorithms and try to figure out how to create feeds that are interesting and engaging with respect to several categories of interest of their user, as well covering several reasons I might be seeking for a recommendation to what to watch (what is everyone else is watching – have something to discuss with my friends; discover something new; follow up on topics I am already interested in, …)

Synergy from the boot on Ubuntu

This one seemed to be quite trivial per official blog, but the whole pipeline gets a bit more complicated once the SSL enters into the game. Here is how I made it work with synergy and Ubuntu 14.04

  • Configure the server and the client with the GUI application
  • Make sure SSL server certificate fingerprint was stored in the ~/.synergy/SSL/Fingerprints/TrustedServers.txt
  • Run sudo -su myself /usr/bin/synergyc -f --enable-crypto my.server.ip.address
  • After that check everything was working with sudo /usr/bin/synergyc -d DEBUG2 -f --enable-crypto my.server.ip.address
  • Finally add the greeter-setup-script=sudo /usr/bin/synergyc --enable-crypto my.server.ip.address line into the /etc/lightdm/lightdm.conf file under the [SeatDefaults] section

Why you shouldn’t do it?

Despite the convenience, there seemed to be a bit or an interference for the keyboard command and command interpretation on my side, so since my two computers side by side and since I have an usb button switch from before I got synergy, I’ve decided to manually start synergy every time I log in.

Linux server security


Now, because of all the occasions at which I had to act as a makeshift sysadmin, I did end up reading a number of policies and pick up some advice I wanted to group in a single place, if but for my own memory.


  • Use SE Linux distro
  • Use an intrusion prevention tool, such as Fail2Ban
  • Configure primary and secondary DHS
  • Switch away from the password-protected SSH to a key-based SSH log-in. Diable root login all together (/etc/ssh/sshd_config, PermitRootLogin no). Here is an Ubuntu/OpenSSH guide.
  • Remove network super-service packages
  • Disable Telnet and FTP (SFTP should be used)
  • use chroot where available, notably for webservers and FTP servers
  • encrypt the filesystem
  • disable remote root login
  • disable sudo su – all the root actions need to be done with a sudo


  • Once the server has been build, run Lynsis. It will audit your system and suggest additional steps to protect your machine
  • Force multi-factor authentification for the roots, especially via SSH. Here is a tutorial from Digital Ocean.

Watching the logs:

If you have more than one logging system to watch:

Configuring PyCharm for remote development

I do most of my programming from my windows laptop and/or desktop computer. However, in order to be able to develop anything sane, I need to operate fully in Linux. I used to have to dualboot or even to have two machines, but now that I have access to a stable server I can safely ssh into, I would rather just use my IDE to develop directly on it. Lucky enough for me, PyCharm has an option for it.

A how-to guide to do this is pretty straightforward, well-explained on the PyCharm blog and docs explaining how to configure a remote server that is not a Vagrant box.

There are three steps in the configuration:

  • setting up the deployment server and auto-update
  • setting up the remote interpreter
  • setting up the run configuration

Setting up the deployment server:

Tools | Deployment | Configuration > configure your sftp server, go ahead and perform the root autodetection (usually the /home/uname) and uncheck the “available only for this project. You will need that last option in order to configure the remote interpreter. Go ahead, go into the mapping, perform the equivalence mappings for the project, but be aware the home from the previous screen, if filled, would be prepended to any path you try to map to on the remote server. So if you want your project to go to /home/uname/PycharmProjects/my_project and your root is /home/uname/, the path you are mapping to needs to be /PycharmProjects/my_projet.

Now, head to the Tools | Deployment click the automatic upload, so that every edit you do on your machine is constantly uploaded to the remote server.

Setting up the remote interpreter:

Head to the File | Settings | Project | Interpreter, click on the cogwheel and click on add remote. At that point by default PyCharm will fill in the properties for the “deployment configuration”. In my case I needed to tweak a bit the python interpreter path, since I use Anaconda Python (scientific computing). If like me you use Anaconda2 and store it in your home directory, you will need to replace the interpreter path by /home/uname/anaconda/bin/python. At that point, just click save and you are good for this part.

Setting up the run configuration:

With the previous two steps finished, when you go into Run | Edit configuration, add the main running script to the Script field, check that the python interpreter is configured to be the remote one and then click on the three small dots next to “path mappings” field and fill it out, at least with the location of the script on your machine mapped to it’s location on the remote.

That’s it, you are good to go!